package org.mhag.swing;

import java.awt.BorderLayout;
import java.awt.Cursor;
import java.awt.Desktop;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.StringSelection;
import java.awt.event.ItemEvent;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.PrintStream;
import java.net.URI;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.Scanner;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.DefaultListCellRenderer;
import javax.swing.DefaultListModel;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JProgressBar;
import javax.swing.JScrollPane;
import javax.swing.ScrollPaneConstants;
import javax.swing.SwingWorker;
import javax.swing.UIManager;
import org.mhag.model.*;

/**
 * @program MHAG
 * @ mhagGUI, partially generated by NetBeans IDE
 * @version 1.2
 * support new talisman system
 * add generator
 * @author Tifa@mh3
 */

public class MhagGui extends javax.swing.JFrame {

    /** Creates new form MhagGui */
    public MhagGui(int gameOpt) {

		//initialize splash window 
		game = gameOpt;
		mhag = new Mhag(gameOpt);

        initComponents();

		// add scrollpane to the frame for low-resoltion screen
		Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
		if(d.width <= this.getWidth())
		{
			JScrollPane scroll = new JScrollPane(jTabbedPane);
			d.setSize(d.width, this.getHeight());
			scroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
			scroll.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
			scroll.setPreferredSize(d);
			add(scroll, BorderLayout.CENTER);
		}

		// set title
		String title =  "MHAG (Monster Hunter Armor Generator) Desktop 2.3c";
		if(game == 0)
			setTitle(title + " for Monster Hunter Tri");
		else if(game == 1)
			setTitle(title + " for Monster Hunter Portable 3rd");
		else if (game == 2)
			setTitle(title + " for Monster Hunter Freedom Unite");
		else if (game == 3)
			setTitle(title + " for Monster Hunter 3 Ultimate");

		// set icon
		setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("/org/mhag/model/pic/logo.png")));

		// align list
		DefaultListCellRenderer rendererNew = (DefaultListCellRenderer)jListSkillList.getCellRenderer();
		rendererNew.setHorizontalAlignment(JLabel.CENTER);

		stream = new TextAreaPrintStream(jTextPreview, System.out);
		streamView = new TextAreaPrintStream(jTextPreview2, System.out);
		streamGen = new TextAreaPrintStream(jTextPreview3, System.out);
		
		// only if mh3 game, jCheckBoxGun is enabled
		if(game == 0)
			jCheckBoxGun.setEnabled(true);
		else
			jCheckBoxGun.setEnabled(false);

		setupAutoCompleteAll();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        rankGroup = new javax.swing.ButtonGroup();
        hunterTypeGroup = new javax.swing.ButtonGroup();
        sexGroup = new javax.swing.ButtonGroup();
        outputGroup = new javax.swing.ButtonGroup();
        buttonGroup1 = new javax.swing.ButtonGroup();
        hunterTypeGen = new javax.swing.ButtonGroup();
        jTabbedPane = new javax.swing.JTabbedPane();
        calculator = new javax.swing.JPanel();
        rank = new javax.swing.JPanel();
        rankMenu = new javax.swing.JComboBox();
        hunterType = new javax.swing.JPanel();
        blade = new javax.swing.JRadioButton();
        gunner = new javax.swing.JRadioButton();
        sex = new javax.swing.JPanel();
        male = new javax.swing.JRadioButton();
        female = new javax.swing.JRadioButton();
        setup = new javax.swing.JPanel();
        weaponMenu = new javax.swing.JComboBox();
        headMenu = new javax.swing.JComboBox();
        chestMenu = new javax.swing.JComboBox();
        armsMenu = new javax.swing.JComboBox();
        waistMenu = new javax.swing.JComboBox();
        legsMenu = new javax.swing.JComboBox();
        charmMenu = new javax.swing.JComboBox();
        weaponLabel = new javax.swing.JLabel();
        headLabel = new javax.swing.JLabel();
        chestLabel = new javax.swing.JLabel();
        armsLabel = new javax.swing.JLabel();
        waistLabel = new javax.swing.JLabel();
        legsLabel = new javax.swing.JLabel();
        charmLabel = new javax.swing.JLabel();
        charmSkillLabel = new javax.swing.JLabel();
        weaponSlot1 = new javax.swing.JComboBox();
        weaponSlot2 = new javax.swing.JComboBox();
        weaponSlot3 = new javax.swing.JComboBox();
        headSlot1 = new javax.swing.JComboBox();
        headSlot2 = new javax.swing.JComboBox();
        headSlot3 = new javax.swing.JComboBox();
        chestSlot1 = new javax.swing.JComboBox();
        chestSlot2 = new javax.swing.JComboBox();
        chestSlot3 = new javax.swing.JComboBox();
        armSlot1 = new javax.swing.JComboBox();
        armSlot2 = new javax.swing.JComboBox();
        armSlot3 = new javax.swing.JComboBox();
        waistSlot1 = new javax.swing.JComboBox();
        waistSlot2 = new javax.swing.JComboBox();
        waistSlot3 = new javax.swing.JComboBox();
        legSlot1 = new javax.swing.JComboBox();
        legSlot2 = new javax.swing.JComboBox();
        legSlot3 = new javax.swing.JComboBox();
        charmSlot1 = new javax.swing.JComboBox();
        charmSlot2 = new javax.swing.JComboBox();
        charmSlot3 = new javax.swing.JComboBox();
        charmSkill1 = new javax.swing.JComboBox();
        charmSkill2 = new javax.swing.JComboBox();
        skillPoint1 = new javax.swing.JComboBox();
        skillPoint2 = new javax.swing.JComboBox();
        materials = new javax.swing.JCheckBox();
        output = new javax.swing.JPanel();
        reset = new javax.swing.JButton();
        langLabel = new javax.swing.JLabel();
        langMenu = new javax.swing.JComboBox();
        aboutButton = new javax.swing.JButton();
        jScrollPreview = new javax.swing.JScrollPane();
        jTextPreview = new javax.swing.JTextArea();
        setNamePanel = new javax.swing.JPanel();
        jTextSetName = new javax.swing.JTextField();
        buttonLink = new javax.swing.JButton();
        buttonGoto = new javax.swing.JButton();
        jLabel1 = new javax.swing.JLabel();
        generator = new javax.swing.JPanel();
        jScrollPreview3 = new javax.swing.JScrollPane();
        jTextPreview3 = new javax.swing.JTextArea();
        skillsPanel = new javax.swing.JPanel();
        skillType = new javax.swing.JComboBox();
        skillTree = new javax.swing.JComboBox();
        skillName = new javax.swing.JComboBox();
        jLabelSkillType = new javax.swing.JLabel();
        jLabelSkillTree = new javax.swing.JLabel();
        jLabelSkillName = new javax.swing.JLabel();
        jButtonAdd = new javax.swing.JButton();
        jButtonRemove = new javax.swing.JButton();
        jButtonUp = new javax.swing.JButton();
        jButtonDown = new javax.swing.JButton();
        jScrollSkillList = new javax.swing.JScrollPane();
        jListSkillList = new javax.swing.JList();
        jButtonShowPiece = new javax.swing.JButton();
        optionPanel = new javax.swing.JPanel();
        jComboBoxWeaponSlots = new javax.swing.JComboBox();
        optLabel = new javax.swing.JLabel();
        jComboBoxOpt = new javax.swing.JComboBox();
        jCheckBoxEarring = new javax.swing.JCheckBox();
        jLabelArmorRank = new javax.swing.JLabel();
        jComboBoxRank = new javax.swing.JComboBox();
        jComboBoxHead = new javax.swing.JComboBox();
        jLabelArmorType = new javax.swing.JLabel();
        jComboBoxType = new javax.swing.JComboBox();
        weaponLabel1 = new javax.swing.JLabel();
        headLabel1 = new javax.swing.JLabel();
        genderLabel = new javax.swing.JLabel();
        jCheckBoxGun = new javax.swing.JCheckBox();
        jComboBoxGender = new javax.swing.JComboBox();
        jCheckBoxCharm = new javax.swing.JCheckBox();
        jButtonSearch = new javax.swing.JButton();
        jProgressOpt = new javax.swing.JProgressBar();
        loadToCalcGen = new javax.swing.JButton();
        jScrollOptSets = new javax.swing.JScrollPane();
        jListOptSets = new javax.swing.JList();
        jButtonAbort = new javax.swing.JButton();
        jButtonMyCharms = new javax.swing.JButton();
        jButtonSettings = new javax.swing.JButton();
        viewer = new javax.swing.JPanel();
        jScrollPreview2 = new javax.swing.JScrollPane();
        jTextPreview2 = new javax.swing.JTextArea();
        codeBook = new javax.swing.JPanel();
        codeBookName = new javax.swing.JTextField();
        codeBookLoad = new javax.swing.JButton();
        codeBookSave = new javax.swing.JButton();
        convert = new javax.swing.JPanel();
        convertTEXT = new javax.swing.JRadioButton();
        convertHTML = new javax.swing.JRadioButton();
        Output = new javax.swing.JButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        codeList = new javax.swing.JList();
        loadSetInteract = new javax.swing.JButton();
        getSetInteract = new javax.swing.JButton();
        deleteInteract = new javax.swing.JButton();
        undoInteract = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setBackground(new java.awt.Color(255, 255, 255));
        setResizable(false);
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosing(java.awt.event.WindowEvent evt) {
                formWindowClosing(evt);
            }
        });

        jTabbedPane.setBackground(new java.awt.Color(255, 255, 255));
        jTabbedPane.setFont(new java.awt.Font("Monospaced", 1, 14));
        jTabbedPane.setOpaque(true);
        jTabbedPane.setPreferredSize(new java.awt.Dimension(1238, 630));

        rank.setBorder(javax.swing.BorderFactory.createTitledBorder("Rank"));
        rank.setToolTipText("Change rank type, reset set");

        rankMenu.setFont(new java.awt.Font("Monospaced", 0, 12));
        rankMenu.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Low Rank", "High Rank", "G Rank" }));
        rankMenu.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                rankMenuActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout rankLayout = new javax.swing.GroupLayout(rank);
        rank.setLayout(rankLayout);
        rankLayout.setHorizontalGroup(
            rankLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(rankLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(rankMenu, 0, 106, Short.MAX_VALUE)
                .addContainerGap())
        );
        rankLayout.setVerticalGroup(
            rankLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(rankLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(rankMenu, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(20, Short.MAX_VALUE))
        );

        hunterType.setBorder(javax.swing.BorderFactory.createTitledBorder("Hunter Type"));
        hunterType.setToolTipText("Change hunter type, reset set");

        hunterTypeGroup.add(blade);
        blade.setFont(new java.awt.Font("Monospaced", 0, 12));
        blade.setSelected(true);
        blade.setText("Blademaster");
        blade.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bladeActionPerformed(evt);
            }
        });

        hunterTypeGroup.add(gunner);
        gunner.setFont(new java.awt.Font("Monospaced", 0, 12));
        gunner.setText("Gunner");
        gunner.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                gunnerActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout hunterTypeLayout = new javax.swing.GroupLayout(hunterType);
        hunterType.setLayout(hunterTypeLayout);
        hunterTypeLayout.setHorizontalGroup(
            hunterTypeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(hunterTypeLayout.createSequentialGroup()
                .addContainerGap(14, Short.MAX_VALUE)
                .addGroup(hunterTypeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(blade)
                    .addComponent(gunner)))
        );
        hunterTypeLayout.setVerticalGroup(
            hunterTypeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(hunterTypeLayout.createSequentialGroup()
                .addComponent(blade)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(gunner))
        );

        sex.setBorder(javax.swing.BorderFactory.createTitledBorder("Gender"));
        sex.setToolTipText("Switch armor names");

        sexGroup.add(male);
        male.setFont(new java.awt.Font("Monospaced", 0, 12));
        male.setSelected(true);
        male.setText("Male");
        male.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                maleActionPerformed(evt);
            }
        });

        sexGroup.add(female);
        female.setFont(new java.awt.Font("Monospaced", 0, 12));
        female.setText("Female");
        female.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                femaleActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout sexLayout = new javax.swing.GroupLayout(sex);
        sex.setLayout(sexLayout);
        sexLayout.setHorizontalGroup(
            sexLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(sexLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(sexLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(male)
                    .addComponent(female))
                .addContainerGap(18, Short.MAX_VALUE))
        );
        sexLayout.setVerticalGroup(
            sexLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(sexLayout.createSequentialGroup()
                .addComponent(male)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(female)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        setup.setBorder(javax.swing.BorderFactory.createTitledBorder("Setup"));
        setup.setPreferredSize(new java.awt.Dimension(625, 390));

        weaponMenu.setFont(new java.awt.Font("Monospaced", 0, 12));
        weaponMenu.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "No Slot", "1 Slot", "2 Slots", "3 Slots" }));
        weaponMenu.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                weaponMenuActionPerformed(evt);
            }
        });

        headMenu.setFont(new java.awt.Font("Monospaced", 0, 12));
        headMenu.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                headMenuActionPerformed(evt);
            }
        });

        chestMenu.setFont(new java.awt.Font("Monospaced", 0, 12));
        chestMenu.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                chestMenuActionPerformed(evt);
            }
        });

        armsMenu.setFont(new java.awt.Font("Monospaced", 0, 12));
        armsMenu.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                armsMenuActionPerformed(evt);
            }
        });

        waistMenu.setFont(new java.awt.Font("Monospaced", 0, 12));
        waistMenu.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                waistMenuActionPerformed(evt);
            }
        });

        legsMenu.setFont(new java.awt.Font("Monospaced", 0, 12));
        legsMenu.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                legsMenuActionPerformed(evt);
            }
        });

        charmMenu.setFont(new java.awt.Font("Monospaced", 0, 12));
        charmMenu.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                charmMenuActionPerformed(evt);
            }
        });

        weaponLabel.setFont(new java.awt.Font("Lucida Sans Typewriter", 0, 12));
        weaponLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/mhag/model/pic/weapon.png"))); // NOI18N
        weaponLabel.setLabelFor(weaponMenu);
        weaponLabel.setToolTipText("Weapon");

        headLabel.setFont(new java.awt.Font("Lucida Sans Typewriter", 0, 12));
        headLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/mhag/model/pic/head.png"))); // NOI18N
        headLabel.setLabelFor(headMenu);
        headLabel.setToolTipText("Head");

        chestLabel.setFont(new java.awt.Font("Lucida Sans Typewriter", 0, 12));
        chestLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/mhag/model/pic/chest.png"))); // NOI18N
        chestLabel.setLabelFor(chestMenu);
        chestLabel.setToolTipText("Chest");

        armsLabel.setFont(new java.awt.Font("Lucida Sans Typewriter", 0, 12));
        armsLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/mhag/model/pic/arms.png"))); // NOI18N
        armsLabel.setLabelFor(armsMenu);
        armsLabel.setToolTipText("Arms");

        waistLabel.setFont(new java.awt.Font("Lucida Sans Typewriter", 0, 12));
        waistLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/mhag/model/pic/waist.png"))); // NOI18N
        waistLabel.setLabelFor(waistMenu);
        waistLabel.setToolTipText("Waist");

        legsLabel.setFont(new java.awt.Font("Lucida Sans Typewriter", 0, 12));
        legsLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/mhag/model/pic/legs.png"))); // NOI18N
        legsLabel.setLabelFor(legsMenu);
        legsLabel.setToolTipText("Legs");

        charmLabel.setFont(new java.awt.Font("Lucida Sans Typewriter", 0, 12));
        charmLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/mhag/model/pic/charm.png"))); // NOI18N
        charmLabel.setLabelFor(charmMenu);
        charmLabel.setToolTipText("Charm");

        charmSkillLabel.setFont(new java.awt.Font("Monospaced", 0, 12));
        charmSkillLabel.setLabelFor(charmSkill1);
        charmSkillLabel.setText("Charm Skill");

        weaponSlot1.setFont(new java.awt.Font("Monospaced", 0, 12));
        weaponSlot1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                weaponSlot1ActionPerformed(evt);
            }
        });

        weaponSlot2.setFont(new java.awt.Font("Monospaced", 0, 12));
        weaponSlot2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                weaponSlot2ActionPerformed(evt);
            }
        });

        weaponSlot3.setFont(new java.awt.Font("Monospaced", 0, 12));
        weaponSlot3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                weaponSlot3ActionPerformed(evt);
            }
        });

        headSlot1.setFont(new java.awt.Font("Monospaced", 0, 12));
        headSlot1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                headSlot1ActionPerformed(evt);
            }
        });

        headSlot2.setFont(new java.awt.Font("Monospaced", 0, 12));
        headSlot2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                headSlot2ActionPerformed(evt);
            }
        });

        headSlot3.setFont(new java.awt.Font("Monospaced", 0, 12));
        headSlot3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                headSlot3ActionPerformed(evt);
            }
        });

        chestSlot1.setFont(new java.awt.Font("Monospaced", 0, 12));
        chestSlot1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                chestSlot1ActionPerformed(evt);
            }
        });

        chestSlot2.setFont(new java.awt.Font("Monospaced", 0, 12));
        chestSlot2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                chestSlot2ActionPerformed(evt);
            }
        });

        chestSlot3.setFont(new java.awt.Font("Monospaced", 0, 12));
        chestSlot3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                chestSlot3ActionPerformed(evt);
            }
        });

        armSlot1.setFont(new java.awt.Font("Monospaced", 0, 12));
        armSlot1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                armSlot1ActionPerformed(evt);
            }
        });

        armSlot2.setFont(new java.awt.Font("Monospaced", 0, 12));
        armSlot2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                armSlot2ActionPerformed(evt);
            }
        });

        armSlot3.setFont(new java.awt.Font("Monospaced", 0, 12));
        armSlot3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                armSlot3ActionPerformed(evt);
            }
        });

        waistSlot1.setFont(new java.awt.Font("Monospaced", 0, 12));
        waistSlot1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                waistSlot1ActionPerformed(evt);
            }
        });

        waistSlot2.setFont(new java.awt.Font("Monospaced", 0, 12));
        waistSlot2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                waistSlot2ActionPerformed(evt);
            }
        });

        waistSlot3.setFont(new java.awt.Font("Monospaced", 0, 12));
        waistSlot3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                waistSlot3ActionPerformed(evt);
            }
        });

        legSlot1.setFont(new java.awt.Font("Monospaced", 0, 12));
        legSlot1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                legSlot1ActionPerformed(evt);
            }
        });

        legSlot2.setFont(new java.awt.Font("Monospaced", 0, 12));
        legSlot2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                legSlot2ActionPerformed(evt);
            }
        });

        legSlot3.setFont(new java.awt.Font("Monospaced", 0, 12));
        legSlot3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                legSlot3ActionPerformed(evt);
            }
        });

        charmSlot1.setFont(new java.awt.Font("Monospaced", 0, 12));
        charmSlot1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                charmSlot1ActionPerformed(evt);
            }
        });

        charmSlot2.setFont(new java.awt.Font("Monospaced", 0, 12));
        charmSlot2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                charmSlot2ActionPerformed(evt);
            }
        });

        charmSlot3.setFont(new java.awt.Font("Monospaced", 0, 12));
        charmSlot3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                charmSlot3ActionPerformed(evt);
            }
        });

        charmSkill1.setFont(new java.awt.Font("Monospaced", 0, 12));
        charmSkill1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                charmSkill1ActionPerformed(evt);
            }
        });

        charmSkill2.setFont(new java.awt.Font("Monospaced", 0, 12));
        charmSkill2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                charmSkill2ActionPerformed(evt);
            }
        });

        skillPoint1.setFont(new java.awt.Font("Monospaced", 0, 12));
        skillPoint1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "0" }));
        skillPoint1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                skillPoint1ActionPerformed(evt);
            }
        });

        skillPoint2.setFont(new java.awt.Font("Monospaced", 0, 12));
        skillPoint2.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "0" }));
        skillPoint2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                skillPoint2ActionPerformed(evt);
            }
        });

        materials.setFont(new java.awt.Font("Monospaced", 0, 12));
        materials.setText("Materials");
        materials.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                materialsItemStateChanged(evt);
            }
        });

        javax.swing.GroupLayout setupLayout = new javax.swing.GroupLayout(setup);
        setup.setLayout(setupLayout);
        setupLayout.setHorizontalGroup(
            setupLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(setupLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(setupLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(setupLayout.createSequentialGroup()
                        .addComponent(weaponLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(weaponMenu, javax.swing.GroupLayout.PREFERRED_SIZE, 170, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(weaponSlot1, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(weaponSlot2, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(weaponSlot3, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(setupLayout.createSequentialGroup()
                        .addComponent(headLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(headMenu, javax.swing.GroupLayout.PREFERRED_SIZE, 170, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(headSlot1, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(headSlot2, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(headSlot3, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(setupLayout.createSequentialGroup()
                        .addComponent(chestLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(chestMenu, javax.swing.GroupLayout.PREFERRED_SIZE, 170, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(chestSlot1, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(chestSlot2, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(chestSlot3, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(setupLayout.createSequentialGroup()
                        .addComponent(armsLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(armsMenu, javax.swing.GroupLayout.PREFERRED_SIZE, 170, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(armSlot1, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(armSlot2, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(armSlot3, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(setupLayout.createSequentialGroup()
                        .addComponent(waistLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(waistMenu, javax.swing.GroupLayout.PREFERRED_SIZE, 170, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(waistSlot1, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(waistSlot2, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(waistSlot3, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(setupLayout.createSequentialGroup()
                        .addComponent(legsLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(legsMenu, javax.swing.GroupLayout.PREFERRED_SIZE, 170, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(legSlot1, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(legSlot2, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(legSlot3, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(setupLayout.createSequentialGroup()
                        .addComponent(charmLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(charmMenu, javax.swing.GroupLayout.PREFERRED_SIZE, 170, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(charmSlot1, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(charmSlot2, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(charmSlot3, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(setupLayout.createSequentialGroup()
                        .addComponent(charmSkillLabel)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(charmSkill1, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(skillPoint1, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(charmSkill2, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(skillPoint2, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 44, Short.MAX_VALUE)
                        .addComponent(materials)))
                .addContainerGap())
        );
        setupLayout.setVerticalGroup(
            setupLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(setupLayout.createSequentialGroup()
                .addGroup(setupLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(weaponLabel, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, setupLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(weaponMenu, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(weaponSlot1, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(weaponSlot2, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(weaponSlot3, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(setupLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(headLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(setupLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(headMenu, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(headSlot1, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(headSlot2, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(headSlot3, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(setupLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(chestLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(setupLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(chestMenu, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(chestSlot1, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(chestSlot2, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(chestSlot3, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(setupLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(armsLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(setupLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(armsMenu, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(armSlot1, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(armSlot2, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(armSlot3, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(18, 18, 18)
                .addGroup(setupLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(waistLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(setupLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(waistMenu, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(waistSlot1, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(waistSlot2, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(waistSlot3, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(18, 18, 18)
                .addGroup(setupLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(legsLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(setupLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(legsMenu, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(legSlot1, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(legSlot2, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(legSlot3, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(18, 18, 18)
                .addGroup(setupLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(charmLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(setupLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(charmMenu, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(charmSlot1, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(charmSlot2, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(charmSlot3, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(18, 18, 18)
                .addGroup(setupLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(charmSkillLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(charmSkill1, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(skillPoint1, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(charmSkill2, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(skillPoint2, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(materials))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        output.setBorder(javax.swing.BorderFactory.createTitledBorder("Settings"));

        reset.setFont(new java.awt.Font("Monospaced", 1, 12));
        reset.setText("Reset");
        reset.setToolTipText("Reset set");
        reset.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                resetActionPerformed(evt);
            }
        });

        langLabel.setFont(new java.awt.Font("Monospaced", 0, 12));
        langLabel.setText("Menu Language");
        langLabel.setOpaque(true);

        langMenu.setFont(new java.awt.Font("Monospaced", 0, 12));
        langMenu.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "English", "Japanese" }));
        langMenu.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                langMenuActionPerformed(evt);
            }
        });

        aboutButton.setFont(new java.awt.Font("Monospaced", 1, 12));
        aboutButton.setText("About MHAG");
        aboutButton.setToolTipText("About");
        aboutButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                aboutButtonActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout outputLayout = new javax.swing.GroupLayout(output);
        output.setLayout(outputLayout);
        outputLayout.setHorizontalGroup(
            outputLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(outputLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(reset, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(langLabel)
                .addGap(18, 18, 18)
                .addComponent(langMenu, javax.swing.GroupLayout.PREFERRED_SIZE, 125, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(aboutButton, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(37, Short.MAX_VALUE))
        );
        outputLayout.setVerticalGroup(
            outputLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(outputLayout.createSequentialGroup()
                .addGroup(outputLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(reset, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(langLabel)
                    .addComponent(langMenu, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(aboutButton, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jScrollPreview.setForeground(javax.swing.UIManager.getDefaults().getColor("Panel.background"));
        jScrollPreview.setFont(new java.awt.Font("Monospaced", 0, 12));
        jScrollPreview.setHorizontalScrollBar(null);

        jTextPreview.setColumns(20);
        jTextPreview.setEditable(false);
        jTextPreview.setFont(new java.awt.Font("Monospaced", 0, 12));
        jTextPreview.setForeground(new java.awt.Color(1, 1, 1));
        jTextPreview.setRows(5);
        jTextPreview.setBorder(javax.swing.BorderFactory.createTitledBorder("Preview (Calculator)"));
        jTextPreview.setCursor(new java.awt.Cursor(java.awt.Cursor.TEXT_CURSOR));
        jScrollPreview.setViewportView(jTextPreview);

        setNamePanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Set Name"));

        jTextSetName.setFont(new java.awt.Font("Monospaced", 0, 12));
        jTextSetName.setText("Unnamed Set");
        jTextSetName.setToolTipText("Input set name, use enter to preview it now");
        jTextSetName.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextSetNameActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout setNamePanelLayout = new javax.swing.GroupLayout(setNamePanel);
        setNamePanel.setLayout(setNamePanelLayout);
        setNamePanelLayout.setHorizontalGroup(
            setNamePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, setNamePanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jTextSetName, javax.swing.GroupLayout.DEFAULT_SIZE, 208, Short.MAX_VALUE)
                .addContainerGap())
        );
        setNamePanelLayout.setVerticalGroup(
            setNamePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(setNamePanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jTextSetName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(25, Short.MAX_VALUE))
        );

        buttonLink.setFont(new java.awt.Font("Monospaced", 1, 12));
        buttonLink.setText("Copy Set Link");
        buttonLink.setToolTipText("Copy MHAG URL");
        buttonLink.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonLinkActionPerformed(evt);
            }
        });

        buttonGoto.setFont(new java.awt.Font("Monospaced", 1, 12));
        buttonGoto.setText("Open Webpage");
        buttonGoto.setToolTipText("See the set in a web browser");
        buttonGoto.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonGotoActionPerformed(evt);
            }
        });

        jLabel1.setFont(new java.awt.Font("Monospaced", 1, 14));
        jLabel1.setText("MHAG Online");
        jLabel1.setOpaque(true);

        javax.swing.GroupLayout calculatorLayout = new javax.swing.GroupLayout(calculator);
        calculator.setLayout(calculatorLayout);
        calculatorLayout.setHorizontalGroup(
            calculatorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(calculatorLayout.createSequentialGroup()
                .addGroup(calculatorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(calculatorLayout.createSequentialGroup()
                        .addGap(24, 24, 24)
                        .addComponent(jLabel1)
                        .addGap(18, 18, 18)
                        .addComponent(buttonLink, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(buttonGoto, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(calculatorLayout.createSequentialGroup()
                        .addGap(12, 12, 12)
                        .addGroup(calculatorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(output, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(calculatorLayout.createSequentialGroup()
                                .addComponent(rank, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(hunterType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(sex, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(setNamePanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
                    .addGroup(calculatorLayout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(setup, javax.swing.GroupLayout.PREFERRED_SIZE, 629, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPreview, javax.swing.GroupLayout.PREFERRED_SIZE, 592, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
        calculatorLayout.setVerticalGroup(
            calculatorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(calculatorLayout.createSequentialGroup()
                .addGroup(calculatorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(calculatorLayout.createSequentialGroup()
                        .addComponent(output, javax.swing.GroupLayout.PREFERRED_SIZE, 57, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(calculatorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(setNamePanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(rank, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(hunterType, javax.swing.GroupLayout.DEFAULT_SIZE, 84, Short.MAX_VALUE)
                            .addComponent(sex, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 12, Short.MAX_VALUE)
                        .addComponent(setup, javax.swing.GroupLayout.PREFERRED_SIZE, 345, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(calculatorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel1)
                            .addComponent(buttonLink, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(buttonGoto, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addComponent(jScrollPreview, javax.swing.GroupLayout.PREFERRED_SIZE, 535, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(30, Short.MAX_VALUE))
        );

        jTabbedPane.addTab("<html><body><table width=\"100\">&nbsp;Calculator</table></body></html>", new javax.swing.ImageIcon(getClass().getResource("/org/mhag/model/pic/calculator.png")), calculator, ""); // NOI18N

        jScrollPreview3.setFont(new java.awt.Font("Monospaced", 0, 12));
        jScrollPreview3.setHorizontalScrollBar(null);

        jTextPreview3.setColumns(20);
        jTextPreview3.setEditable(false);
        jTextPreview3.setFont(new java.awt.Font("Monospaced", 0, 12));
        jTextPreview3.setForeground(new java.awt.Color(1, 1, 1));
        jTextPreview3.setRows(5);
        jTextPreview3.setBorder(javax.swing.BorderFactory.createTitledBorder("Preview (Generator)"));
        jTextPreview3.setCursor(new java.awt.Cursor(java.awt.Cursor.TEXT_CURSOR));
        jScrollPreview3.setViewportView(jTextPreview3);

        skillsPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Skills"));
        skillsPanel.setOpaque(false);

        skillType.setFont(new java.awt.Font("Monospaced", 0, 12));
        skillType.setPreferredSize(new java.awt.Dimension(56, 25));
        skillType.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                skillTypeActionPerformed(evt);
            }
        });

        skillTree.setFont(new java.awt.Font("Monospaced", 0, 12));
        skillTree.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                skillTreeActionPerformed(evt);
            }
        });

        skillName.setFont(new java.awt.Font("Monospaced", 0, 12));

        jLabelSkillType.setFont(new java.awt.Font("Monospaced", 0, 12));
        jLabelSkillType.setText("Type");
        jLabelSkillType.setToolTipText("Skill filter according to skill types");

        jLabelSkillTree.setFont(new java.awt.Font("Monospaced", 0, 12));
        jLabelSkillTree.setText("Tree");

        jLabelSkillName.setFont(new java.awt.Font("Monospaced", 0, 12));
        jLabelSkillName.setText("Name");

        jButtonAdd.setFont(new java.awt.Font("Monospaced", 1, 12));
        jButtonAdd.setText("Add");
        jButtonAdd.setToolTipText("Add skill to the end");
        jButtonAdd.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonAddActionPerformed(evt);
            }
        });

        jButtonRemove.setFont(new java.awt.Font("Monospaced", 1, 12));
        jButtonRemove.setText("Remove");
        jButtonRemove.setToolTipText("Remove the selected skill");
        jButtonRemove.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonRemoveActionPerformed(evt);
            }
        });

        jButtonUp.setFont(new java.awt.Font("Monospaced", 1, 12));
        jButtonUp.setText("Move Up");
        jButtonUp.setToolTipText("Move the selected skill up");
        jButtonUp.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonUpActionPerformed(evt);
            }
        });

        jButtonDown.setFont(new java.awt.Font("Monospaced", 1, 12));
        jButtonDown.setText("Move Down");
        jButtonDown.setToolTipText("Move the selected skill down");
        jButtonDown.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonDownActionPerformed(evt);
            }
        });

        jListSkillList.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Skill List   (skill order may affect results, put important skills first)", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Dialog", 0, 12))); // NOI18N
        jListSkillList.setFont(new java.awt.Font("Ubuntu", 0, 12));
        jListSkillList.setForeground(new java.awt.Color(1, 1, 1));
        jListSkillList.setModel(new javax.swing.AbstractListModel() {
            String[] strings = { "---", "---", "---", "---", "---", "---", "---", "---", "---", "---" };
            public int getSize() { return strings.length; }
            public Object getElementAt(int i) { return strings[i]; }
        });
        jListSkillList.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        jListSkillList.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        jListSkillList.setFixedCellHeight(20);
        jListSkillList.setFixedCellWidth(115);
        jListSkillList.setLayoutOrientation(javax.swing.JList.HORIZONTAL_WRAP);
        jListSkillList.setVisibleRowCount(2);
        jScrollSkillList.setViewportView(jListSkillList);

        jButtonShowPiece.setFont(new java.awt.Font("Monospaced", 1, 12));
        jButtonShowPiece.setText("Suggestion");
        jButtonShowPiece.setToolTipText("Show suggested armor pieces");
        jButtonShowPiece.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonShowPieceActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout skillsPanelLayout = new javax.swing.GroupLayout(skillsPanel);
        skillsPanel.setLayout(skillsPanelLayout);
        skillsPanelLayout.setHorizontalGroup(
            skillsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(skillsPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(skillsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(skillsPanelLayout.createSequentialGroup()
                        .addComponent(jLabelSkillType)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(skillType, javax.swing.GroupLayout.PREFERRED_SIZE, 145, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jLabelSkillTree)
                        .addGap(6, 6, 6)
                        .addComponent(skillTree, javax.swing.GroupLayout.PREFERRED_SIZE, 145, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jLabelSkillName)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(skillName, javax.swing.GroupLayout.PREFERRED_SIZE, 145, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(skillsPanelLayout.createSequentialGroup()
                        .addComponent(jButtonAdd, javax.swing.GroupLayout.PREFERRED_SIZE, 107, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jButtonRemove, javax.swing.GroupLayout.PREFERRED_SIZE, 107, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jButtonUp, javax.swing.GroupLayout.PREFERRED_SIZE, 107, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jButtonDown, javax.swing.GroupLayout.PREFERRED_SIZE, 107, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jButtonShowPiece, javax.swing.GroupLayout.PREFERRED_SIZE, 107, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jScrollSkillList, javax.swing.GroupLayout.PREFERRED_SIZE, 589, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        skillsPanelLayout.setVerticalGroup(
            skillsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(skillsPanelLayout.createSequentialGroup()
                .addGroup(skillsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabelSkillType)
                    .addComponent(skillType, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabelSkillName)
                    .addComponent(skillName, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabelSkillTree)
                    .addComponent(skillTree, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(skillsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButtonAdd, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButtonRemove, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButtonUp, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButtonDown, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButtonShowPiece, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollSkillList, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(13, Short.MAX_VALUE))
        );

        optionPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Options"));
        optionPanel.setOpaque(false);

        jComboBoxWeaponSlots.setFont(new java.awt.Font("Monospaced", 0, 12));
        jComboBoxWeaponSlots.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "0 Slot", "1 Slot", "2 Slots", "3 Slots", "Any" }));
        jComboBoxWeaponSlots.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboBoxWeaponSlotsActionPerformed(evt);
            }
        });

        optLabel.setFont(new java.awt.Font("Monospaced", 0, 12));
        optLabel.setLabelFor(jComboBoxOpt);
        optLabel.setText("Mode");
        optLabel.setToolTipText("Search method");
        optLabel.setOpaque(true);

        jComboBoxOpt.setFont(new java.awt.Font("Monospaced", 0, 12));
        jComboBoxOpt.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Full", "Partial", "Jewel Opt" }));
        jComboBoxOpt.setToolTipText("");
        jComboBoxOpt.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboBoxOptActionPerformed(evt);
            }
        });

        jCheckBoxEarring.setFont(new java.awt.Font("Monospaced", 0, 12));
        jCheckBoxEarring.setText("Earrings");
        jCheckBoxEarring.setToolTipText("Include earring pieces");
        jCheckBoxEarring.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                jCheckBoxEarringItemStateChanged(evt);
            }
        });

        jLabelArmorRank.setFont(new java.awt.Font("Monospaced", 0, 12));
        jLabelArmorRank.setText("Rank");
        jLabelArmorRank.setToolTipText("Rank of armor pieces");
        jLabelArmorRank.setOpaque(true);

        jComboBoxRank.setFont(new java.awt.Font("Monospaced", 0, 12));
        jComboBoxRank.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Any", "Low Rank Only", "High Rank Only", "G Rank Only", "No G Rank", "No Low Rank" }));
        jComboBoxRank.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboBoxRankActionPerformed(evt);
            }
        });

        jComboBoxHead.setFont(new java.awt.Font("Monospaced", 0, 12));
        jComboBoxHead.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Any", "Melee", "Gunner" }));
        jComboBoxHead.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboBoxHeadActionPerformed(evt);
            }
        });

        jLabelArmorType.setFont(new java.awt.Font("Monospaced", 0, 12));
        jLabelArmorType.setText("Type");
        jLabelArmorType.setToolTipText("Hunter type (for full search)");
        jLabelArmorType.setOpaque(true);

        jComboBoxType.setFont(new java.awt.Font("Monospaced", 0, 12));
        jComboBoxType.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Melee", "Gunner" }));
        jComboBoxType.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboBoxTypeActionPerformed(evt);
            }
        });

        weaponLabel1.setFont(new java.awt.Font("Lucida Sans Typewriter", 0, 12));
        weaponLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/mhag/model/pic/weapon.png"))); // NOI18N
        weaponLabel1.setLabelFor(weaponMenu);
        weaponLabel1.setToolTipText("Weapon");

        headLabel1.setFont(new java.awt.Font("Lucida Sans Typewriter", 0, 12));
        headLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/mhag/model/pic/head.png"))); // NOI18N
        headLabel1.setLabelFor(headMenu);
        headLabel1.setToolTipText("Head");

        genderLabel.setFont(new java.awt.Font("Lucida Sans Typewriter", 0, 12));
        genderLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/mhag/model/pic/gender.png"))); // NOI18N
        genderLabel.setLabelFor(jComboBoxGender);
        genderLabel.setToolTipText("Gender");

        jCheckBoxGun.setFont(new java.awt.Font("Monospaced", 0, 12));
        jCheckBoxGun.setText("SplitGun");
        jCheckBoxGun.setToolTipText("Gun slots are from different gun parts");
        jCheckBoxGun.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                jCheckBoxGunItemStateChanged(evt);
            }
        });

        jComboBoxGender.setFont(new java.awt.Font("Monospaced", 0, 12));
        jComboBoxGender.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Male", "Female" }));
        jComboBoxGender.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboBoxGenderActionPerformed(evt);
            }
        });

        jCheckBoxCharm.setFont(new java.awt.Font("Monospaced", 0, 12));
        jCheckBoxCharm.setText("MyCharms");
        jCheckBoxCharm.setToolTipText("Include customized charms");
        jCheckBoxCharm.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                jCheckBoxCharmItemStateChanged(evt);
            }
        });

        javax.swing.GroupLayout optionPanelLayout = new javax.swing.GroupLayout(optionPanel);
        optionPanel.setLayout(optionPanelLayout);
        optionPanelLayout.setHorizontalGroup(
            optionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(optionPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(optionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabelArmorType)
                    .addComponent(jLabelArmorRank)
                    .addComponent(optLabel))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(optionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jComboBoxRank, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jComboBoxOpt, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jComboBoxType, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(12, 12, 12)
                .addGroup(optionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(headLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(weaponLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(genderLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(optionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(optionPanelLayout.createSequentialGroup()
                        .addGroup(optionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jComboBoxHead, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jComboBoxGender, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(optionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jCheckBoxEarring)
                            .addComponent(jCheckBoxCharm)))
                    .addGroup(optionPanelLayout.createSequentialGroup()
                        .addComponent(jComboBoxWeaponSlots, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jCheckBoxGun)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        optionPanelLayout.setVerticalGroup(
            optionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(optionPanelLayout.createSequentialGroup()
                .addGroup(optionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(optionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jComboBoxType, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabelArmorType))
                    .addComponent(headLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(optionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jComboBoxHead, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jCheckBoxEarring)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(optionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(optionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jComboBoxGender, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jCheckBoxCharm))
                    .addComponent(genderLabel)
                    .addGroup(optionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jComboBoxRank, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabelArmorRank)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(optionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(optionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jComboBoxOpt, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(optLabel))
                    .addGroup(optionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addGroup(optionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jComboBoxWeaponSlots, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jCheckBoxGun))
                        .addComponent(weaponLabel1)))
                .addContainerGap())
        );

        jButtonSearch.setFont(new java.awt.Font("Monospaced", 1, 12));
        jButtonSearch.setText("Search");
        jButtonSearch.setToolTipText("Start search");
        jButtonSearch.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonSearchActionPerformed(evt);
            }
        });

        jProgressOpt.setFont(new java.awt.Font("Monospaced", 0, 12));

        loadToCalcGen.setFont(new java.awt.Font("Monospaced", 1, 12));
        loadToCalcGen.setText("Load to Calculator");
        loadToCalcGen.setToolTipText("Load the selected set");
        loadToCalcGen.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                loadToCalcGenActionPerformed(evt);
            }
        });

        jListOptSets.setBorder(javax.swing.BorderFactory.createTitledBorder("Search Results"));
        jListOptSets.setFont(new java.awt.Font("Monospaced", 0, 12));
        jListOptSets.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        jListOptSets.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
            public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
                jListOptSetsValueChanged(evt);
            }
        });
        jScrollOptSets.setViewportView(jListOptSets);

        jButtonAbort.setFont(new java.awt.Font("Monospaced", 1, 12));
        jButtonAbort.setText("Abort");
        jButtonAbort.setToolTipText("Abort search");
        jButtonAbort.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonAbortActionPerformed(evt);
            }
        });

        jButtonMyCharms.setFont(new java.awt.Font("Monospaced", 1, 12));
        jButtonMyCharms.setText("Charms");
        jButtonMyCharms.setToolTipText("Customized charms");
        jButtonMyCharms.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonMyCharmsActionPerformed(evt);
            }
        });

        jButtonSettings.setFont(new java.awt.Font("Monospaced", 1, 12));
        jButtonSettings.setText("Advanced");
        jButtonSettings.setToolTipText("Advanced settings");
        jButtonSettings.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonSettingsActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout generatorLayout = new javax.swing.GroupLayout(generator);
        generator.setLayout(generatorLayout);
        generatorLayout.setHorizontalGroup(
            generatorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(generatorLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(generatorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(generatorLayout.createSequentialGroup()
                        .addComponent(optionPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 419, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(generatorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(generatorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                .addComponent(loadToCalcGen, javax.swing.GroupLayout.PREFERRED_SIZE, 195, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jProgressOpt, javax.swing.GroupLayout.PREFERRED_SIZE, 195, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(generatorLayout.createSequentialGroup()
                                .addGroup(generatorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jButtonMyCharms, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jButtonSearch, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(generatorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jButtonAbort, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jButtonSettings, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                    .addComponent(skillsPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jScrollOptSets, javax.swing.GroupLayout.PREFERRED_SIZE, 623, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jScrollPreview3, javax.swing.GroupLayout.DEFAULT_SIZE, 604, Short.MAX_VALUE))
        );
        generatorLayout.setVerticalGroup(
            generatorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(generatorLayout.createSequentialGroup()
                .addGroup(generatorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(generatorLayout.createSequentialGroup()
                        .addComponent(skillsPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(generatorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(generatorLayout.createSequentialGroup()
                                .addGap(6, 6, 6)
                                .addGroup(generatorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(jButtonMyCharms, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jButtonSettings, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(generatorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(jButtonSearch, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jButtonAbort, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jProgressOpt, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(loadToCalcGen, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(optionPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 118, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jScrollOptSets, javax.swing.GroupLayout.PREFERRED_SIZE, 240, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jScrollPreview3, javax.swing.GroupLayout.PREFERRED_SIZE, 535, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(25, Short.MAX_VALUE))
        );

        jTabbedPane.addTab("<html><body><table width=\"100\">&nbsp;&nbsp;Generator</table></body></html>", new javax.swing.ImageIcon(getClass().getResource("/org/mhag/model/pic/generator.png")), generator, ""); // NOI18N

        jScrollPreview2.setFont(new java.awt.Font("Monospaced", 0, 12));
        jScrollPreview2.setHorizontalScrollBar(null);

        jTextPreview2.setColumns(20);
        jTextPreview2.setEditable(false);
        jTextPreview2.setFont(new java.awt.Font("Monospaced", 0, 12));
        jTextPreview2.setForeground(new java.awt.Color(1, 1, 1));
        jTextPreview2.setRows(5);
        jTextPreview2.setBorder(javax.swing.BorderFactory.createTitledBorder("Preview (Viewer)"));
        jTextPreview2.setCursor(new java.awt.Cursor(java.awt.Cursor.TEXT_CURSOR));
        jScrollPreview2.setViewportView(jTextPreview2);

        codeBook.setBorder(javax.swing.BorderFactory.createTitledBorder("Code Book"));

        codeBookName.setFont(new java.awt.Font("Monospaced", 0, 12));
        codeBookName.setText("MyData");

        codeBookLoad.setFont(new java.awt.Font("Monospaced", 1, 12));
        codeBookLoad.setText("Load");
        codeBookLoad.setToolTipText("Load code book");
        codeBookLoad.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                codeBookLoadActionPerformed(evt);
            }
        });

        codeBookSave.setFont(new java.awt.Font("Monospaced", 1, 12));
        codeBookSave.setText("Save");
        codeBookSave.setToolTipText("Save code  book, overwrite the old file");
        codeBookSave.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                codeBookSaveActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout codeBookLayout = new javax.swing.GroupLayout(codeBook);
        codeBook.setLayout(codeBookLayout);
        codeBookLayout.setHorizontalGroup(
            codeBookLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(codeBookLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(codeBookName, javax.swing.GroupLayout.PREFERRED_SIZE, 175, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(codeBookLoad, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(codeBookSave, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(12, 12, 12))
        );
        codeBookLayout.setVerticalGroup(
            codeBookLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(codeBookLayout.createSequentialGroup()
                .addGroup(codeBookLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(codeBookName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(codeBookLoad)
                    .addComponent(codeBookSave))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        convert.setBorder(javax.swing.BorderFactory.createTitledBorder("Export Sets"));
        convert.setOpaque(false);

        buttonGroup1.add(convertTEXT);
        convertTEXT.setFont(new java.awt.Font("Monospaced", 0, 12));
        convertTEXT.setSelected(true);
        convertTEXT.setText("TEXT");
        convertTEXT.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                convertTEXTActionPerformed(evt);
            }
        });

        buttonGroup1.add(convertHTML);
        convertHTML.setFont(new java.awt.Font("Monospaced", 0, 12));
        convertHTML.setText("HTML");
        convertHTML.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                convertHTMLActionPerformed(evt);
            }
        });

        Output.setFont(new java.awt.Font("Monospaced", 1, 12));
        Output.setText("Save & Export");
        Output.setToolTipText("Save code book, and output sets");
        Output.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                OutputActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout convertLayout = new javax.swing.GroupLayout(convert);
        convert.setLayout(convertLayout);
        convertLayout.setHorizontalGroup(
            convertLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(convertLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(convertTEXT)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(convertHTML)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(Output, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );
        convertLayout.setVerticalGroup(
            convertLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(convertLayout.createSequentialGroup()
                .addGroup(convertLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(convertTEXT)
                    .addComponent(convertHTML)
                    .addComponent(Output))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jScrollPane1.setFont(new java.awt.Font("Monospaced", 0, 12));

        codeList.setBorder(javax.swing.BorderFactory.createTitledBorder("Code List"));
        codeList.setFont(new java.awt.Font("Monospaced", 0, 12));
        codeList.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        codeList.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
            public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
                codeListValueChanged(evt);
            }
        });
        jScrollPane1.setViewportView(codeList);

        loadSetInteract.setFont(new java.awt.Font("Monospaced", 1, 12));
        loadSetInteract.setText("Load to Calculator");
        loadSetInteract.setToolTipText("Load the selected set");
        loadSetInteract.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                loadSetInteractActionPerformed(evt);
            }
        });

        getSetInteract.setFont(new java.awt.Font("Monospaced", 1, 12));
        getSetInteract.setText("Add from Calculator");
        getSetInteract.setToolTipText("Add the set below");
        getSetInteract.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                getSetInteractActionPerformed(evt);
            }
        });

        deleteInteract.setFont(new java.awt.Font("Monospaced", 1, 12));
        deleteInteract.setText("Remove/Cut");
        deleteInteract.setToolTipText("Remove/cut the selected set (max 5) ");
        deleteInteract.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                deleteInteractActionPerformed(evt);
            }
        });

        undoInteract.setFont(new java.awt.Font("Monospaced", 1, 12));
        undoInteract.setText("Paste");
        undoInteract.setToolTipText("Append the recently removed set (max 5)");
        undoInteract.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                undoInteractActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout viewerLayout = new javax.swing.GroupLayout(viewer);
        viewer.setLayout(viewerLayout);
        viewerLayout.setHorizontalGroup(
            viewerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, viewerLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(viewerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(viewerLayout.createSequentialGroup()
                        .addComponent(loadSetInteract, javax.swing.GroupLayout.PREFERRED_SIZE, 170, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(getSetInteract, javax.swing.GroupLayout.PREFERRED_SIZE, 170, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(deleteInteract, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(undoInteract, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, viewerLayout.createSequentialGroup()
                        .addGroup(viewerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 645, Short.MAX_VALUE)
                            .addGroup(viewerLayout.createSequentialGroup()
                                .addComponent(codeBook, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 31, Short.MAX_VALUE)
                                .addComponent(convert, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGap(8, 8, 8)))
                .addComponent(jScrollPreview2, javax.swing.GroupLayout.PREFERRED_SIZE, 586, javax.swing.GroupLayout.PREFERRED_SIZE))
        );
        viewerLayout.setVerticalGroup(
            viewerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(viewerLayout.createSequentialGroup()
                .addGroup(viewerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(viewerLayout.createSequentialGroup()
                        .addGroup(viewerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(codeBook, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(convert, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 435, Short.MAX_VALUE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(viewerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(loadSetInteract)
                            .addComponent(getSetInteract)
                            .addComponent(deleteInteract)
                            .addComponent(undoInteract)))
                    .addComponent(jScrollPreview2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 535, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(26, Short.MAX_VALUE))
        );

        jTabbedPane.addTab("<html><body><table width=\"100\">&nbsp;&nbsp;&nbsp;Viewer</table></body></html>", new javax.swing.ImageIcon(getClass().getResource("/org/mhag/model/pic/viewer.png")), viewer, ""); // NOI18N

        getContentPane().add(jTabbedPane, java.awt.BorderLayout.CENTER);
        jTabbedPane.getAccessibleContext().setAccessibleName("<html><body><table width=\"300\">&nbsp;Calculator</table></body></html>");

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void bladeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bladeActionPerformed
	    // set to blademaster
	    if(set.getBlade() == true )return;

	    set.setBlade(true);
	    initSetup(set.getRank(), set.getBlade(), set.getFemale());
    }//GEN-LAST:event_bladeActionPerformed

    private void gunnerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_gunnerActionPerformed
	    // set to blademaster
	    if(set.getBlade() == false )return;

	    set.setBlade(false);
	    initSetup(set.getRank(), set.getBlade(), set.getFemale());
    }//GEN-LAST:event_gunnerActionPerformed

    private void maleActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_maleActionPerformed
	    // set to male
	    if(set.getFemale() == false )return;

	    set.setFemale(false);
	    // TODO get & keep armorID

	    changeGender(set.getRank(), set.getBlade(), set.getFemale());
    }//GEN-LAST:event_maleActionPerformed

    private void femaleActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_femaleActionPerformed
	    // set to female
	    if(set.getFemale() == true )return;

	    set.setFemale(true);
	    // TODO get & keep armorID

	    changeGender(set.getRank(), set.getBlade(), set.getFemale());
    }//GEN-LAST:event_femaleActionPerformed

    private void headMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_headMenuActionPerformed
	    armorMenuAction(0);
    }//GEN-LAST:event_headMenuActionPerformed

    private void chestMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chestMenuActionPerformed
	    armorMenuAction(1);
    }//GEN-LAST:event_chestMenuActionPerformed

    private void armsMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_armsMenuActionPerformed
	    armorMenuAction(2);
    }//GEN-LAST:event_armsMenuActionPerformed

    private void waistMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_waistMenuActionPerformed
	    armorMenuAction(3);
    }//GEN-LAST:event_waistMenuActionPerformed

    private void legsMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_legsMenuActionPerformed
	    armorMenuAction(4);
    }//GEN-LAST:event_legsMenuActionPerformed

    private void weaponMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_weaponMenuActionPerformed
	    weaponMenuAction();
    }//GEN-LAST:event_weaponMenuActionPerformed

    private void charmMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_charmMenuActionPerformed
  	    charmMenuAction();
    }//GEN-LAST:event_charmMenuActionPerformed

    private void charmSkill1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_charmSkill1ActionPerformed
	    charmSkillAction(0);
    }//GEN-LAST:event_charmSkill1ActionPerformed

    private void charmSkill2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_charmSkill2ActionPerformed
	    charmSkillAction(1);
    }//GEN-LAST:event_charmSkill2ActionPerformed

    private void weaponSlot1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_weaponSlot1ActionPerformed
	    jewelSlotAction(5, 0);
    }//GEN-LAST:event_weaponSlot1ActionPerformed

    private void weaponSlot2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_weaponSlot2ActionPerformed
	    jewelSlotAction(5, 1);
    }//GEN-LAST:event_weaponSlot2ActionPerformed

    private void weaponSlot3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_weaponSlot3ActionPerformed
	    jewelSlotAction(5, 2);
    }//GEN-LAST:event_weaponSlot3ActionPerformed

    private void headSlot1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_headSlot1ActionPerformed
	    jewelSlotAction(0, 0);
    }//GEN-LAST:event_headSlot1ActionPerformed

    private void headSlot2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_headSlot2ActionPerformed
	    jewelSlotAction(0, 1);
    }//GEN-LAST:event_headSlot2ActionPerformed

    private void headSlot3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_headSlot3ActionPerformed
	    jewelSlotAction(0, 2);
    }//GEN-LAST:event_headSlot3ActionPerformed

    private void chestSlot1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chestSlot1ActionPerformed
	    jewelSlotAction(1, 0);
    }//GEN-LAST:event_chestSlot1ActionPerformed

    private void chestSlot2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chestSlot2ActionPerformed
	    jewelSlotAction(1, 1);
    }//GEN-LAST:event_chestSlot2ActionPerformed

    private void chestSlot3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chestSlot3ActionPerformed
	    jewelSlotAction(1, 2);
    }//GEN-LAST:event_chestSlot3ActionPerformed

    private void armSlot1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_armSlot1ActionPerformed
	    jewelSlotAction(2, 0);
    }//GEN-LAST:event_armSlot1ActionPerformed

    private void armSlot2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_armSlot2ActionPerformed
	    jewelSlotAction(2, 1);
    }//GEN-LAST:event_armSlot2ActionPerformed

    private void armSlot3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_armSlot3ActionPerformed
	    jewelSlotAction(2, 2);
    }//GEN-LAST:event_armSlot3ActionPerformed

    private void waistSlot1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_waistSlot1ActionPerformed
	    jewelSlotAction(3, 0);
    }//GEN-LAST:event_waistSlot1ActionPerformed

    private void waistSlot2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_waistSlot2ActionPerformed
	    jewelSlotAction(3, 1);
    }//GEN-LAST:event_waistSlot2ActionPerformed

    private void legSlot1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_legSlot1ActionPerformed
	    jewelSlotAction(4, 0);
    }//GEN-LAST:event_legSlot1ActionPerformed

    private void legSlot2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_legSlot2ActionPerformed
	    jewelSlotAction(4, 1);
    }//GEN-LAST:event_legSlot2ActionPerformed

    private void legSlot3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_legSlot3ActionPerformed
	    jewelSlotAction(4, 2);
    }//GEN-LAST:event_legSlot3ActionPerformed

    private void charmSlot1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_charmSlot1ActionPerformed
	    jewelSlotAction(6, 0);
    }//GEN-LAST:event_charmSlot1ActionPerformed

    private void charmSlot2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_charmSlot2ActionPerformed
	    jewelSlotAction(6, 1);
    }//GEN-LAST:event_charmSlot2ActionPerformed

    private void charmSlot3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_charmSlot3ActionPerformed
	    jewelSlotAction(6, 2);
    }//GEN-LAST:event_charmSlot3ActionPerformed

    private void codeBookLoadActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_codeBookLoadActionPerformed

	    String codeFile = codeBookName.getText();
	    if(!codeFile.endsWith(".code"))
		    codeFile = codeFile+".code";

	    Scanner codeIn;

		try {
			codeIn = new Scanner(new File(mhagData.getDirSave(game) + codeFile));
		} catch (FileNotFoundException ex) {
			jTextPreview2.setText("");
			String message = String.format("Code File %s doesnot exist!\n",codeFile);
			jTextPreview2.append(message);
			message = String.format("A new Code Book has been created\n");
			jTextPreview2.append(message);
			listModel.clear();
			codeList.setModel(listModel);
			codeBookInUse = true;
			if(!fileNameCodeBook.equals(codeBookName.getText())) //name changed,save pref
				try {
					fileNameCodeBook = codeBookName.getText();
				savePref();
			} catch (FileNotFoundException ex2) {
				Logger.getLogger(MhagGui.class.getName()).log(Level.SEVERE, null, ex2);
			}
			return;
		}

	    listModel.clear();
	    while(codeIn.hasNext())
	    {
		    String codeLine = codeIn.nextLine();
		    listModel.addElement(codeLine);
	    }

	    adjust = true;
	    codeList.setModel(listModel);
	    codeList.clearSelection();
	    adjust = false;

	    codeIn.close();
	    codeBookInUse = true;
	    jTextPreview2.setText("");  //clear Preview when loading codebook

	    if(!fileNameCodeBook.equals(codeBookName.getText())) //name changed,save pref
		    try {
		        fileNameCodeBook = codeBookName.getText();
			savePref();
		} catch (FileNotFoundException ex) {
			Logger.getLogger(MhagGui.class.getName()).log(Level.SEVERE, null, ex);
		}

    }//GEN-LAST:event_codeBookLoadActionPerformed

    private void codeBookSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_codeBookSaveActionPerformed
		try {
			codeBookSave();
			codeBookChanged = false;  // reset book change status

		        if(!fileNameCodeBook.equals(codeBookName.getText())) //name changed,save pref
			{
				fileNameCodeBook = codeBookName.getText();
				savePref();
			}

		} catch (FileNotFoundException ex) {
			Logger.getLogger(MhagGui.class.getName()).log(Level.SEVERE, null, ex);
		}
    }//GEN-LAST:event_codeBookSaveActionPerformed

    private void codeBookSave() throws FileNotFoundException
    {
	    //ListModel listModel =  codeList.getModel();
	    int num = listModel.getSize();
	    if(num == 0)
	    {
		    jTextPreview2.setText("Don't have any code! Why save it?!\n");
		    return;
	    }

	    String codeFile = codeBookName.getText();
	    PrintStream codeOut;
	    if(!codeFile.endsWith(".code"))
		    codeFile = codeFile+".code";

	    codeOut = new PrintStream(mhagData.getDirSave(game) + codeFile);

	    for(int i = 0; i < num; i++)
	    {
		    String codeLine = (String) listModel.getElementAt(i);
		    codeOut.println(codeLine);
	    }

    }

    private void convertTEXTActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_convertTEXTActionPerformed
	    saveOpt = 0;
	    //saveOpt = 2;  //for wiki 
    }//GEN-LAST:event_convertTEXTActionPerformed

    private void convertHTMLActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_convertHTMLActionPerformed
	    saveOpt = 1;
    }//GEN-LAST:event_convertHTMLActionPerformed

    private void OutputActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_OutputActionPerformed

		//saveOpt = 2;
		try {
			codeBookSave();
			codeBookChanged = false;  // reset book change status

		        if(!fileNameCodeBook.equals(codeBookName.getText())) //name changed,save pref
			{
				fileNameCodeBook = codeBookName.getText();
				savePref();
			}
		} catch (FileNotFoundException ex) {
			Logger.getLogger(MhagGui.class.getName()).log(Level.SEVERE, null, ex);
		}

	    String codeFile = codeBookName.getText();
	    String saveFile = "";
	    //PrintStream codeOut;
	    if(!codeFile.endsWith(".code"))
	    {
		    if(saveOpt == 0)
			    saveFile = codeFile+".txt";
		    else
			    saveFile = codeFile+".html";

		    codeFile = codeFile+".code";
	    }
	    else
	    {
		    int pos = codeFile.indexOf(".code");
		    String codePart = codeFile.substring(0,pos);
		    if(saveOpt == 0)
			    saveFile = codePart+".txt";
		    else
			    saveFile = codePart+".html";
	    }

	    mhag.setFileIn(mhagData.getDirSave(game) + codeFile);
	    mhag.setFileOut(mhagData.getDirSave(game) + saveFile);
	    mhag.setOutFormat(saveOpt);

		try {
			mhagData.batchCalc(mhag); //use batch calculator module
		} catch (FileNotFoundException ex) {
			Logger.getLogger(MhagGui.class.getName()).log(Level.SEVERE, null, ex);
		}

	    mhag.setOutFormat(0); //back to text format

    }//GEN-LAST:event_OutputActionPerformed

    private void codeListValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_codeListValueChanged
	    if(!evt.getValueIsAdjusting()) //solve the problem of running twice !
		    codePreview();
    }//GEN-LAST:event_codeListValueChanged

    private void loadSetInteractActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_loadSetInteractActionPerformed
	    if(!codeBookInUse)return;
	    String setCode = (String) codeList.getSelectedValue();
	    loadSet2Calc(setCode);
    }//GEN-LAST:event_loadSetInteractActionPerformed

    private void getSetInteractActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_getSetInteractActionPerformed
	    //read set name, in case users input it , but foget to 'set' it 
	    //by 'enter' key and not adjusting with other options
	    String setName = jTextSetName.getText();
	    set.setSetName(setName);

	    String codeLine = set.getSetCode();
	    int ind = codeList.getSelectedIndex();
	    listModel.insertElementAt(codeLine, ind+1);
	    codeList.setSelectedIndex(ind+1);

	    codeBookChanged = true;  //insert the set , so mark it changed
    }//GEN-LAST:event_getSetInteractActionPerformed

    private void deleteInteractActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteInteractActionPerformed
	    int ind = codeList.getSelectedIndex();

	    //save deleted code;
	    String codeLine = (String) codeList.getSelectedValue();
	    for(int i = 4; i > 0; i--)
		    deletedCodes[i] = deletedCodes[i-1];
	    deletedCodes[0] = codeLine;

	    //remove code element
	    listModel.removeElementAt(ind);

	    //move index
	    int indNext;
	    if(listModel.size() == ind)
		    indNext = ind - 1;
	    else
		    indNext = ind;
	    codeList.setSelectedIndex(indNext);

	    codeBookChanged = true;  //delete the set , so mark it changed
    }//GEN-LAST:event_deleteInteractActionPerformed

    private void jTextSetNameActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextSetNameActionPerformed
	    String setName = jTextSetName.getText();
	    set.setSetName(setName);
	    calSetGUI();
    }//GEN-LAST:event_jTextSetNameActionPerformed

    private void undoInteractActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_undoInteractActionPerformed
	    //append deleted code
	    String codeLine = deletedCodes[0];
	    if(codeLine.equals(""))return; // Don't append empty code

	    int ind = codeList.getSelectedIndex();
	    listModel.insertElementAt(codeLine, ind+1);
	    codeList.setSelectedIndex(ind+1);

	    //remove the code from the list ofdeleted codes
	    for(int i = 0; i < 4; i++)
		    deletedCodes[i] = deletedCodes[i+1];
	    deletedCodes[4] = "";

	    /*for(int i = 0; i < 5; i++)
		    System.out.println("here:"+deletedCodes[i]);
	    System.out.println("========================");
	     */

	    codeBookChanged = true;  //paste the set , so mark it changed
    }//GEN-LAST:event_undoInteractActionPerformed

    private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing
	    if(!codeBookChanged)return;

	SaveAndExit dialog = new SaveAndExit(new javax.swing.JFrame(), true);
	dialog.setLocationRelativeTo(codeBookSave);
	dialog.setVisible(true);

	if(dialog.getReturnStatus() == 1)
	{
		try {
			codeBookSave();
		        if(!fileNameCodeBook.equals(codeBookName.getText())) //name changed,save pref
			{
				fileNameCodeBook = codeBookName.getText();
				savePref();
			}
		} catch (FileNotFoundException ex) {
			Logger.getLogger(MhagGui.class.getName()).log(Level.SEVERE, null, ex);
		}
	}

    }//GEN-LAST:event_formWindowClosing

    private void skillPoint1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_skillPoint1ActionPerformed
	    charmPointAction(0);
    }//GEN-LAST:event_skillPoint1ActionPerformed

    private void skillPoint2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_skillPoint2ActionPerformed
	    charmPointAction(1);
    }//GEN-LAST:event_skillPoint2ActionPerformed

	private void skillTreeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_skillTreeActionPerformed
		skillTreeAction();
	}//GEN-LAST:event_skillTreeActionPerformed

	private void jButtonAddActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonAddActionPerformed
		skillAddAction();
	}//GEN-LAST:event_jButtonAddActionPerformed

	private void jButtonSettingsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonSettingsActionPerformed
		if(!ifAdvance)
		{
			ifAdvance = true;
			advDialog = new GenAdvanced(new javax.swing.JFrame(), true, gen);
			advDialog.setLocationRelativeTo(jButtonSettings);
		}
		advDialog.setVisible(false);    // add to make the settings  to the front
		advDialog.toFront();
		advDialog.setVisible(true);
	}//GEN-LAST:event_jButtonSettingsActionPerformed

	private void skillTypeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_skillTypeActionPerformed
		skillTypeAction();
	}//GEN-LAST:event_skillTypeActionPerformed

	private void jCheckBoxCharmItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_jCheckBoxCharmItemStateChanged
		if (evt.getStateChange() == ItemEvent.DESELECTED)
		{
			gen.setIfCharm(false);
		}
			//gen.setIncludeOpt(ind, false);
		else
		{
			gen.setIfCharm(true);
		}
		//checkBoxOptionItem(evt, 3);
	}//GEN-LAST:event_jCheckBoxCharmItemStateChanged

	private void jComboBoxWeaponSlotsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxWeaponSlotsActionPerformed
		int ind = jComboBoxWeaponSlots.getSelectedIndex();
		if(ind <= 0)
			gen.setNumWeaponSlot(0);
		else if(ind > 3)
			gen.setNumWeaponSlot(-1);
		else
			gen.setNumWeaponSlot(ind);

		/*
		if((mhag.getGame() == 0) && (!gen.getBlade()) && (gen.getNumWeaponSlot() > 1)) 
		{
			jCheckBoxGun.setEnabled(true);
			if(jCheckBoxGun.isSelected())
				gen.setIfSlotGunPart(true);
			else
				gen.setIfSlotGunPart(false);
		}
		else
		{
			jCheckBoxGun.setEnabled(false);
			gen.setIfSlotGunPart(false);
		}
		//System.out.println(gen.getIfSlotGunPart());
		 */

	}//GEN-LAST:event_jComboBoxWeaponSlotsActionPerformed

	private void jComboBoxOptActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxOptActionPerformed
		searchOptAction();
	}//GEN-LAST:event_jComboBoxOptActionPerformed

	private void jButtonRemoveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonRemoveActionPerformed
		skillListRemoveAction();
	}//GEN-LAST:event_jButtonRemoveActionPerformed

	private void jButtonUpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonUpActionPerformed
		skillListUpAction();
	}//GEN-LAST:event_jButtonUpActionPerformed

	private void jButtonDownActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonDownActionPerformed
		skillListDownAction();
	}//GEN-LAST:event_jButtonDownActionPerformed

	private void jButtonSearchActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonSearchActionPerformed
		searchAction();
	}//GEN-LAST:event_jButtonSearchActionPerformed

	private void jListOptSetsValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_jListOptSetsValueChanged
	    if(!evt.getValueIsAdjusting()) //solve the problem of running twice !
		    codePreviewGen();
	}//GEN-LAST:event_jListOptSetsValueChanged

	private void loadToCalcGenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_loadToCalcGenActionPerformed
		if(jListOptSets.getSelectedIndex() < 0)return;
	    String setCode = (String) jListOptSets.getSelectedValue();
	    loadSet2Calc(setCode);
	}//GEN-LAST:event_loadToCalcGenActionPerformed

	private void jButtonAbortActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonAbortActionPerformed
		task.cancel(true); //abort task
	}//GEN-LAST:event_jButtonAbortActionPerformed

	private void jButtonMyCharmsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonMyCharmsActionPerformed
		if(!ifCharm)
		{
			ifCharm = true;
			charmDialog = new CharmDialog(new javax.swing.JFrame(), true, mhag, mhagData, gen);
			charmDialog.setLocationRelativeTo(jButtonMyCharms);
		}
		charmDialog.setVisible(false);    // add to make the charm  to the front
		charmDialog.toFront();
		charmDialog.setVisible(true);
	}//GEN-LAST:event_jButtonMyCharmsActionPerformed

	private void buttonLinkActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonLinkActionPerformed
		URI uri = set.getSetCodeURI(mhag);
		String url = uri.toASCIIString();
		StringSelection data = new StringSelection(url);
		Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
		clipboard.setContents(data, data);
	}//GEN-LAST:event_buttonLinkActionPerformed

	private void buttonGotoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonGotoActionPerformed
		try {
			Desktop desktop = Desktop.getDesktop();
			desktop.browse(set.getSetCodeURI(mhag));
		} catch (IOException ex) {
			//Logger.getLogger(MhagGui.class.getName()).log(Level.SEVERE, null, ex);
		}
	}//GEN-LAST:event_buttonGotoActionPerformed

	private void resetActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_resetActionPerformed
    	initGUISet();
	    jTextSetName.setText(Set.getDefaultSetName());

		rankMenu.setSelectedIndex(mhagData.getMaxRank(game));
		//lowRank.setSelected(false);
		//highRank.setSelected(true);
		blade.setSelected(true);
		gunner.setSelected(false);
	    male.setSelected(true);
	    female.setSelected(false);
	    initSetup(mhagData.getMaxRank(game), true, false);
	}//GEN-LAST:event_resetActionPerformed

	private void langMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_langMenuActionPerformed
		language = langMenu.getSelectedIndex();
	    changeLanguage(set.getFemale());
	}//GEN-LAST:event_langMenuActionPerformed

	private void jCheckBoxEarringItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_jCheckBoxEarringItemStateChanged
		if (evt.getStateChange() == ItemEvent.DESELECTED)
			gen.setIfEarring(false);
			//gen.setIncludeOpt(ind, false);
		else
			gen.setIfEarring(true);
			//gen.setIncludeOpt(ind, true);
		//checkBoxOptionItem(evt, 2);
}//GEN-LAST:event_jCheckBoxEarringItemStateChanged

	private void jComboBoxTypeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxTypeActionPerformed
		if(jComboBoxType.getSelectedIndex() == 0)
			gen.setBlade(true);
		else
			gen.setBlade(false);
	}//GEN-LAST:event_jComboBoxTypeActionPerformed

	private void jComboBoxRankActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxRankActionPerformed
		gen.setArmorRankOpt(jComboBoxRank.getSelectedIndex());
	}//GEN-LAST:event_jComboBoxRankActionPerformed

	private void jComboBoxHeadActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxHeadActionPerformed
		gen.setArmorHeadOpt(jComboBoxHead.getSelectedIndex());
	}//GEN-LAST:event_jComboBoxHeadActionPerformed

	private void jButtonShowPieceActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonShowPieceActionPerformed
		// TODO add your handling code here:
		showPieces();
	}//GEN-LAST:event_jButtonShowPieceActionPerformed

	private void aboutButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_aboutButtonActionPerformed
		if(!ifAbout)
		{
			ifAbout = true;
			aboutDialog = new About(new javax.swing.JFrame(), true);
			aboutDialog.setLocationRelativeTo(null);
		}
		aboutDialog.setVisible(false);    // add to make the charm  to the front
		aboutDialog.toFront();
		aboutDialog.setVisible(true);
	}//GEN-LAST:event_aboutButtonActionPerformed

	private void waistSlot3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_waistSlot3ActionPerformed

		jewelSlotAction(3, 2); 	}//GEN-LAST:event_waistSlot3ActionPerformed

	private void rankMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rankMenuActionPerformed
		// here
		int rankInd = rankMenu.getSelectedIndex();
	    if(set.getRank() == rankInd )return;
	    set.setRank(rankInd);
	    initSetup(set.getRank(), set.getBlade(), set.getFemale());

	}//GEN-LAST:event_rankMenuActionPerformed

	private void jCheckBoxGunItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_jCheckBoxGunItemStateChanged

		if (evt.getStateChange() == ItemEvent.DESELECTED) { 			gen.setIfCheckGun(false); 		} else { 			gen.setIfCheckGun(true); 		} 	}//GEN-LAST:event_jCheckBoxGunItemStateChanged

	private void jComboBoxGenderActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxGenderActionPerformed
		if(jComboBoxGender.getSelectedIndex() == 0)
			gen.setFemale(false);
		else
			gen.setFemale(true);
	}//GEN-LAST:event_jComboBoxGenderActionPerformed

	private void materialsItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_materialsItemStateChanged
		if (evt.getStateChange() == ItemEvent.DESELECTED)
		{
			showItem = false;
			calSetGUI();
		}
		else
		{
			showItem = true;
			calSetGUI();
		}
	}//GEN-LAST:event_materialsItemStateChanged

	//show possible pieces for generator
	private void showPieces()
	{
		if(gen.getGenMode() == 2)
			return;
		if(gen.getNumEffectOpt() <= 0)
			return;

		int rankInd = mhagData.getMaxRank(game);
		boolean ifBlade = true;
		boolean ifFemale = false;
	    streamGen.reset();
		streamGen.println("====== Recommended Armor Pieces ======");

		if (gen.getGenMode() == 1)
		{
			rankInd = set.getRank();
			ifBlade = set.getBlade();
			ifFemale = set.getFemale();

			for(int bodyPart = 0; bodyPart < 5; bodyPart++)
			{
				int[] armorList;
				if(set.getInUse(bodyPart))
				{
					//only one
					armorList = new int[1];
					armorList[0] = set.getArmorID(bodyPart);
				}
				else
				{
					armorList = gen.getArmorList(rankInd, ifBlade, ifFemale, bodyPart);
				}
				outputArmor(streamGen, bodyPart, armorList);
			}
		}
		else
		{
			int rankOpt = gen.getArmorRankOpt();
			if(rankOpt == 1)  //if low rank pieces only
				rankInd = 0;
			else if(rankOpt == 2) // if high rank only
				rankInd = 1;
			else if(rankOpt == 4) // if low/high rank only
				rankInd = 1;

			ifBlade = gen.getBlade();
			ifFemale = gen.getFemale();
			//System.out.println(ifBlade);

			for(int bodyPart = 0; bodyPart < 5; bodyPart++)
			{
				int[] armorList = gen.getArmorList(rankInd, ifBlade, ifFemale, bodyPart);
				outputArmor(streamGen, bodyPart, armorList);
			}
		}
		streamGen.println();
		streamGen.println();
		streamGen.println("====== All Armor Pieces with Selected Skills ======");
		streamGen.println("------ (sorted by combined skill points)------"); 

		for(int bodyPart = 0; bodyPart < 5; bodyPart++)
		{
			int[] armorList = gen.getArmorListAll(rankInd, ifBlade, ifFemale, bodyPart);
			outputArmor(streamGen, bodyPart, armorList);
		}

	    streamGen.rewind();
	}

	private void outputArmor(PrintStream outSave, int bodyPart, int[] armorList)
	{
		if(bodyPart == 0)
			outSave.printf("Head Pieces:");
		else if (bodyPart == 1)
			outSave.printf("Chest Pieces:");
		else if (bodyPart == 2)
			outSave.printf("Arm Pieces:");
		else if (bodyPart == 3)
			outSave.printf("Waist Pieces:");
		else if (bodyPart == 4)
			outSave.printf("Leg Pieces:");

		int num = armorList.length;
		outSave.printf(" (%d)\n", num);
		int low = (num - 1)/3 +1;

		int ind = 0;
		for(int i = 0; i < low - 1; i++)
		{
			for(int j = 0; j < 3; j++)
			{
				Armor armor = mhagData.getArmor(bodyPart, armorList[ind]);
				outSave.printf("%s, ", armor.getArmorName());
				ind++;
			}
			outSave.printf("\n");
		}
		if(ind != num)
		{
			for(int i = ind; i < num; i++)
			{
				Armor armor = mhagData.getArmor(bodyPart, armorList[i]);
				outSave.printf("%s, ", armor.getArmorName());
				ind++;
			}
			outSave.printf("\n");
		}
		outSave.printf("\n");

	}

	// search option action (disable/enable button/menus)
	private void searchOptAction()
	{
		int ind = jComboBoxOpt.getSelectedIndex();
		if(ind < 0)return;
		gen.setGenMode(ind);

		if(ind == 2) //talisman opt
		{
			jComboBoxType.setEnabled(false);
			jComboBoxRank.setEnabled(false);
			jComboBoxHead.setEnabled(false);
			jCheckBoxEarring.setEnabled(false);
			jCheckBoxCharm.setEnabled(false);
			jComboBoxGender.setEnabled(false);
		}
		else if (ind == 1) //partial search
		{
			jComboBoxType.setEnabled(false);
			jComboBoxRank.setEnabled(true);
			jComboBoxHead.setEnabled(true);
			jCheckBoxEarring.setEnabled(true);
			jCheckBoxCharm.setEnabled(true);
			jComboBoxGender.setEnabled(false);
		}
		else //full search
		{
			jComboBoxType.setEnabled(true);
			jComboBoxRank.setEnabled(true);
			jComboBoxHead.setEnabled(true);
			jCheckBoxEarring.setEnabled(true);
			jCheckBoxCharm.setEnabled(true);
			jComboBoxGender.setEnabled(true);
		}
	}

	// main search action
	private void searchAction()
	{
		listModelOpt.clear();
		streamGen.reset();

		if(gen.getNumEffectOpt() <= 0)
		{
			if(gen.getGenMode() == 2) //jewel optimization
			{
				// no effects are inputed, automatically generate the list
				gen.generateSkillList(set);
			}
			else
				return;
		}
		else
		{
			setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
			disableGen(true);
			jProgressOpt.setString(null);
			jProgressOpt.setValue(0);
			cpuTime = new Date().getTime();
		}
		task = new Task();
		task.execute();  // start background task
	}

	public void mainTask(Task task)
	{
		setCodeGUI = new GenGUI(gen, mhag, mhagData).genMainGui(task, this, set);
	}

	private void disableGen(boolean ifDisable)
	{
		if(ifDisable)
		{
			//jTabbedPane.setEnabledAt(0, false); //diable calc
			//jTabbedPane.setEnabledAt(2, false); //diable viewer
			jButtonAdd.setEnabled(false);
			jButtonRemove.setEnabled(false);
			jButtonUp.setEnabled(false);
			jButtonDown.setEnabled(false);
			jButtonShowPiece.setEnabled(false);
			jComboBoxWeaponSlots.setEnabled(false);
			jButtonSearch.setEnabled(false);
			loadToCalcGen.setEnabled(false);
			jListOptSets.setEnabled(false);

			//disable for test
			jButtonMyCharms.setEnabled(false);
			jButtonSettings.setEnabled(false);
			jComboBoxOpt.setEnabled(false);
			jComboBoxType.setEnabled(false);
			jComboBoxRank.setEnabled(false);
			jComboBoxHead.setEnabled(false);
			jCheckBoxEarring.setEnabled(false);
			jCheckBoxCharm.setEnabled(false);
			jCheckBoxGun.setEnabled(false);
			jComboBoxGender.setEnabled(false);
		}
		else
		{
			//jTabbedPane.setEnabledAt(0, true); // enable calc
			//jTabbedPane.setEnabledAt(2, true); // enable viewer
			jButtonAdd.setEnabled(true);
			jButtonRemove.setEnabled(true);
			jButtonUp.setEnabled(true);
			jButtonDown.setEnabled(true);
			jButtonShowPiece.setEnabled(true);
			jComboBoxWeaponSlots.setEnabled(true);
			jButtonSearch.setEnabled(true);
			loadToCalcGen.setEnabled(true);
			jListOptSets.setEnabled(true);

			searchOptAction();
			jButtonMyCharms.setEnabled(true);
			jButtonSettings.setEnabled(true);
			jComboBoxOpt.setEnabled(true);

			if(game == 0)
				jCheckBoxGun.setEnabled(true);
			else
				jCheckBoxGun.setEnabled(false);

			//disable for test
			/*
			jRadioBlade.setEnabled(false);
			jRadioGunner.setEnabled(false);
			jCheckBoxLowRank.setEnabled(false);
			jCheckBoxHighRank.setEnabled(false);
			jCheckBoxPiercing.setEnabled(false);
			jCheckBoxCharm.setEnabled(false);
			 */
		}

	}

	private void addOptList(String[] setCodes)
	{
		int num = setCodes.length;
		if(num <= 0)
		{
			listModelOpt.clear();
			streamGen.reset();
			return;
		}

	    adjust = true;
		listModelOpt.clear();
		for(int i = 0; i < num; i++)
			listModelOpt.insertElementAt(setCodes[i],i);
		jListOptSets.setModel(listModelOpt);
	    adjust = false;
		jListOptSets.setSelectedIndex(0);
	}

	/*
	private void checkBoxOptionItem(java.awt.event.ItemEvent evt, int ind)
	{
		if (evt.getStateChange() == ItemEvent.DESELECTED)
			gen.setIncludeOpt(ind, false);
		else
			gen.setIncludeOpt(ind, true);
		//System.out.println(Arrays.toString(gen.getIncludeOpt()));
	}
	 */

    private void codePreview()
    {
	    if(adjust) return; //when loading code book
	    if(codeList.getSelectedIndex() < 0) return; //not initiate;

	    streamView.reset();

	    String setCode = (String) codeList.getSelectedValue();

	    Set aSet = new Set();

	    boolean pass = true;
	    pass = aSet.setSetFromCode(mhag, setCode); //read set

	    if(pass)
		    pass = aSet.checkSet(mhag, mhagData);  //check set
	    if(!pass)
	    {
		    jTextPreview2.setText("Error in set code!\n");
		    return;
	    }
	    aSet.calcSet(mhag, mhagData);   //calculate set

	    mhag.setOutFormat(0);
	    aSet.save(mhag, mhagData, streamView);  // save results
	    streamView.rewind();

    }

    private void codePreviewGen()
    {
	    if(adjust) return; //when loading codes of generated sets
	    if(jListOptSets.getSelectedIndex() < 0) return; //not initiate;

	    streamGen.reset();

	    String setCode = (String) jListOptSets.getSelectedValue();

	    Set aSet = new Set();

	    boolean pass = true;
	    pass = aSet.setSetFromCode(mhag, setCode); //read set

	    if(pass)
		    pass = aSet.checkSet(mhag, mhagData);  //check set
	    if(!pass)
	    {
		    jTextPreview3.setText("Error in set code!\n");
		    return;
	    }
	    aSet.calcSet(mhag, mhagData);   //calculate set

	    mhag.setOutFormat(0);
	    aSet.save(mhag, mhagData, streamGen);  // save results
	    streamGen.rewind();

    }

    private void loadSet2Calc(String setCode)
    {
		showPreview = false;
	    Set aSet = new Set();

	    boolean pass = true;
	    pass = aSet.setSetFromCode(mhag, setCode); //read set

	    if(pass)
		    pass = aSet.checkSet(mhag, mhagData);  //check set

	    if(!pass)
	    {
		    jTextPreview2.append("Forbid loading wrong code to calculator!\n");
		    return;
	    }

	    initGUISet();

	    // start load
	    jTextSetName.setText(aSet.getSetName());

		rankMenu.setSelectedIndex(aSet.getRank());

	    if(aSet.getBlade())
	    {
		    blade.setSelected(true);
		    gunner.setSelected(false);
	    }
	    else
	    {
		    blade.setSelected(false);
		    gunner.setSelected(true);
	    }

		if(aSet.getSetGender(mhagData).equals("F"))
		{
			male.setSelected(false);
			female.setSelected(true);
			aSet.setFemale(true);
		}
		else
		{
			male.setSelected(true);
			female.setSelected(false);
			aSet.setFemale(false);
		}

	    set.setBlade(aSet.getBlade());
	    set.setRank(aSet.getRank());
	    set.setFemale(aSet.getFemale());

	    initSetup(aSet.getRank(), aSet.getBlade(), aSet.getFemale());

	    //weapon menu
	    int nJewel = aSet.getNumJewel(5);
	    int nSlot = 0;
	    for(int i = 0; i < nJewel; i++)
		    nSlot += mhagData.getJewel(aSet.getJewelID()[5][i]).getNumSlot();

	    weaponMenu.setSelectedIndex(nSlot);
	    weaponMenuAction();

	    //body menu
	    for (int i = 0; i < 5; i++)
	    {
		    int armorID = aSet.getArmorID()[i];
		    JComboBox bodyMenu = getArmorMenuObj(i);

		    if(!aSet.getInUse(i))
		    {
			    bodyMenu.setSelectedIndex(0);
			    armorMenuAction(i);
		    }
		    else
		    {
			    int[] list = mhagData.getArmorList(aSet.getRank(),
				   aSet.getBlade(), aSet.getFemale(), i);
			    for (int j = 0; j < list.length; j++)
			    {
				    if(list[j] == armorID)
				    {
					    bodyMenu.setSelectedIndex(j);
					    armorMenuAction(i);
					    break;
				    }
			    }
		    }
	    }

	    //charm menu
	    int[] list2;
	    int nCharmSlot = aSet.getNumCharmSlot();
	    if(!aSet.getInUse(6))
	    {
		    charmMenu.setSelectedIndex(0);
		    charmMenuAction();
	    }
	    else
	    {
		    charmMenu.setSelectedIndex(nCharmSlot);
		    charmMenuAction();
	    }

	    //jewel menu
	    for(int i = 0; i< 7; i++)
	    {
		    for(int j = 0; j < aSet.getNumJewel(i); j++)
		    {
			    int jewelID = aSet.getJewelID()[i][j];
			    JComboBox jewelSlot = getJewelSlotObj(i,j);

			    int[] list = mhagData.getJewelList(aSet.getRank(),
				    jewelMenuType[i][j]);
			    for (int k = 0; k < list.length; k++)
			    {
				    if(list[k] == jewelID)
				    {
					    jewelSlot.setSelectedIndex(k);
					    jewelSlotAction(i,j);
					    break;
				    }
			    }

		    }
	    }

	    //charm skill
	    int nSkill = aSet.getNumCharmSkill();
	    int rankInd = aSet.getRank();
	    int maxPoint = 0;
	    int skillID = 0;
	    int skillID2 = 0;
	    int point = 0;
	    if(nSkill >= 1)
	    {
		    skillID = aSet.getCharmSkillID()[0];

		    list2 = mhagData.getSkillList(rankInd, nCharmSlot);
		    for (int j = 0; j < list2.length; j++)
		    {
			    if(list2[j] == skillID)
			    {
				    charmSkill1.setSelectedIndex(j+1);
				    charmSkillAction(0);
				    break;
			    }
		    }

		    Skill skill = mhagData.getSkill(skillID);
		    maxPoint = skill.getMaxSkillPoint(rankInd, nCharmSlot);
		    point = aSet.getCharmSkillPoint()[0];
		    skillPoint1.setSelectedIndex(maxPoint - point);
		    charmPointAction(0);

	    }
	    if(nSkill == 2)
	    {
		    skillID2 = aSet.getCharmSkillID()[1];

		    list2 = mhagData.getSkillList(rankInd, nCharmSlot, skillID, "Auto-Guard");
		    for (int j = 0; j < list2.length; j++)
		    {
			    if(list2[j] == skillID2)
			    {
				    charmSkill2.setSelectedIndex(j+1);
				    charmSkillAction(1);
				    break;
			    }
		    }

		    Skill skill = mhagData.getSkill(skillID2);
		    maxPoint = skill.getMaxSkillPoint(rankInd, nCharmSlot);
		    point = aSet.getCharmSkillPoint()[1];
		    skillPoint2.setSelectedIndex(maxPoint - point);
		    charmPointAction(1);

	    }
		showPreview = true;
		calSetGUI();

    }

	/*
    private void appendData() throws FileNotFoundException
    {
	    calSetGUI();
	    PrintStream saveStream;
	    String saveData = jTextData.getText();
	    if(saveOpt == 0) //text file
	    {
		    if(!saveData.endsWith(".txt"))
			    saveData = saveData + ".txt";
		    saveStream = MhagUtil.streamAppendFile(saveData);
		    mhag.setOutFormat(0);
		    set.save(mhag, mhagData, saveStream);  // save results

	    }
	    else if (saveOpt == 1)
	    {
		    if(!saveData.endsWith(".html"))
			    saveData = saveData + ".html";
		    saveStream = MhagUtil.streamAppendFile(saveData);
		    mhag.setOutFormat(1);

		    saveStream.printf("<p style=\"page-break-before:always\">" +
				"Set :</p>\n");
		    set.save(mhag, mhagData, saveStream);  // save results

		    mhag.setOutFormat(0);

	    }
	    else
	    {
		    if(!saveData.endsWith(".code"))
			    saveData = saveData + ".code";
		    saveStream = MhagUtil.streamAppendFile(saveData);
		    String codeLine = set.getSetCode();   //get set code
		    saveStream.println(codeLine);
	    }
	    saveStream.close();

    }
	 */

    private void weaponMenuAction()
    {
	   int ind = weaponMenu.getSelectedIndex();
	   int bodyPart = 5;

	   if(ind <= 0 )
	   {
		   set.setInUse(bodyPart, false);
		   set.setNumJewel(bodyPart, 0);  //initiate jewel
		   Arrays.fill(jewelInd[bodyPart], 0);  // inititate jewelInd
		   Arrays.fill(jewelMenuType[bodyPart], 0);  // inititate menu type
		   for (int i = 0; i < 3; i++)
		   {
			   changeJewelSlot(bodyPart, i, set.getRank(), 0, false);
		   }
		   calSetGUI();
	   }
	   else
	   {
		   set.setInUse(bodyPart, true);

		   // get number of slots
		   int nSlot = ind;
		   //initialiate jewel menu lists
		   set.setNumJewel(bodyPart, nSlot);
		   Arrays.fill(jewelInd[bodyPart], 0);  // inititate jewelInd
		   for (int i = 0; i < nSlot; i++)  //start from 1
		   {
			   changeJewelSlot(bodyPart, i, set.getRank(), nSlot, true);
		   }
		   for (int i = nSlot; i < 3; i++)
		   {
			   changeJewelSlot(bodyPart, i, set.getRank(), 0, false);
		   }

	   }

    }

    private void armorMenuAction(int bodyPart)
    {
	    if(adjust)return;  //for male/female change

	   JComboBox bodyMenu = getArmorMenuObj(bodyPart);

	   int ind = bodyMenu.getSelectedIndex();

	   if(ind <= 0 )
	   {
		   set.setInUse(bodyPart, false);
		   set.setArmorID(bodyPart, 0);  //initial armor id
		   set.setNumJewel(bodyPart, 0);  //initiate jewel
		   Arrays.fill(jewelInd[bodyPart], 0);  // inititate jewelInd
		   Arrays.fill(jewelMenuType[bodyPart], 0);  // inititate menu type
		   for (int i = 0; i < 3; i++)  //start from 1
			   changeJewelSlot(bodyPart, i, set.getRank(), 0, false);
		   calSetGUI();
	   }
	   else
	   {
		   // obtain list value
		   int[] list = mhagData.getArmorList(set.getRank(),
			   set.getBlade(), set.getFemale(), bodyPart);
		   int armorID = list[ind];
		   if(set.getInUse(bodyPart)&&(armorID == set.getArmorID()[bodyPart]))return; //no change, no reset

		   // set armor id
		   set.setInUse(bodyPart, true);
		   set.setArmorID(bodyPart, armorID);

		   // get number of slots
		   Armor armor = mhagData.getArmor(bodyPart, armorID);
		   int nSlot = armor.getNumSlot();
		   //initialiate jewel menu lists
		   set.setNumJewel(bodyPart, nSlot);
		   Arrays.fill(jewelInd[bodyPart], 0);  // inititate jewelInd
		   for (int i = 0; i < nSlot; i++)  //start from 1
		   {
			   changeJewelSlot(bodyPart, i, set.getRank(), nSlot, true);
		   }
		   for (int i = nSlot; i < 3; i++)
		   {
			   changeJewelSlot(bodyPart, i, set.getRank(), 0, false);
		   }

		   if(nSlot == 0)calSetGUI();
	   }
    }

    private void charmMenuAction()
    {
	   int nSlot = charmMenu.getSelectedIndex();
	   if(nSlot < 0)return;
	   set.setNumCharmSlot(nSlot);
	   set.setNumCharmSkill(0);
	   set.setCharmSkillID(0, -1);
	   set.setCharmSkillID(1, -1);
	   set.setCharmSkillPoint(0, 0);
	   set.setCharmSkillPoint(1, 0);

	   int bodyPart = 6;
	   int rankInd = set.getRank();
	   if(nSlot > 0)
		   set.setInUse(bodyPart, true);
	   else
		   set.setInUse(bodyPart, false);

	   //initialiate jewel menu lists
	   set.setNumJewel(bodyPart, nSlot);
	   Arrays.fill(jewelInd[bodyPart], 0);  // inititate jewelInd
	   for (int i = 0; i < nSlot; i++)  //start from 1
	   {
		   changeJewelSlot(bodyPart, i, set.getRank(), nSlot, true);
	   }
	   for (int i = nSlot; i < 3; i++)
	   {
		   changeJewelSlot(bodyPart, i, set.getRank(), 0, false);
	   }

	   changeCharmSkill(0, rankInd, nSlot, true);
	   changeCharmPoint(0, rankInd, nSlot, -1, true);
	   changeCharmSkill(1, rankInd, nSlot, false);
	   changeCharmPoint(1, rankInd, nSlot, -1, false);

	   calSetGUI();
    }

    private void charmSkillAction(int slotInd)
    {
	    if(adjust)return;
	    int rankInd = set.getRank();
	    int nSlot = set.getNumCharmSlot();
	    if(slotInd == 0)
	    {
		   //charm skill 1
		   int ind = charmSkill1.getSelectedIndex();
		   if(ind <= 0)
		   {
			   changeCharmPoint(0, rankInd, nSlot, -1, true);
			   changeCharmSkill(1, rankInd, nSlot, false);
			   changeCharmPoint(1, rankInd, nSlot, -1, false);
			   if(nSlot <= 0)
				   set.setInUse(6, false); //slot no use
			   calSetGUI();
			   return;
		   }

		   int[] list = mhagData.getSkillList(rankInd, nSlot);
		   set.setCharmSkillID(0,list[ind-1]);
		   set.setNumCharmSkill(0);   //no charm skill determined

		   changeCharmPoint(0, rankInd, nSlot, set.getCharmSkillID()[0], true);
		   changeCharmSkill(1, rankInd, nSlot, false);
		   changeCharmPoint(1, rankInd, nSlot, -1, false);
	    }
	    else
	    {
		    //charm skill 2
		   int ind = charmSkill2.getSelectedIndex();
		   if(ind <= 0)
		   {
			   changeCharmPoint(1, rankInd, nSlot, -1, true);
			   calSetGUI();
			   return;
		   }

		   int[] list = mhagData.getSkillList(rankInd, nSlot, set.getCharmSkillID()[0], "Auto-Guard");
		   set.setCharmSkillID(1,list[ind-1]);
		   set.setNumCharmSkill(1);  // only the 1st charm skill determined

		   changeCharmPoint(1, rankInd, nSlot, set.getCharmSkillID()[1], true);

	    }
	    calSetGUI();
    }

    private void charmPointAction(int slotInd)
    {
	    if(adjust)return;
	    int rankInd = set.getRank();
	    int nSlot = set.getNumCharmSlot();
	    if(slotInd == 0)
	    {
		   //charm skill point 1
		   int ind = skillPoint1.getSelectedIndex();
		   int skillID = set.getCharmSkillID()[0];
		   if((ind < 0) || (skillID < 0))
		   {
			   if(nSlot <= 0)
				   set.setInUse(6, false);  //slot no use
			   set.setNumCharmSkill(0);
			   changeCharmPoint(0, rankInd, nSlot, -1, true);
			   changeCharmSkill(1, rankInd, nSlot, false);
			   changeCharmPoint(1, rankInd, nSlot, -1, false);
			   return;
		   }

		   Skill skill = mhagData.getSkill(skillID);

		   int maxPoint = skill.getMaxSkillPoint(rankInd, nSlot);
		   set.setCharmSkillPoint(0,maxPoint - ind);

		   if(skill.getSkillName().equals("Auto-Guard"))
		   {
			   set.setCharmSkillPoint(0,10);
			   set.setInUse(6, true);
			   set.setNumCharmSkill(1);
			   changeCharmSkill(1, rankInd, nSlot, false);
			   changeCharmPoint(1, rankInd, nSlot, -1, false);
		   }
		   else if(set.getCharmSkillPoint()[0] != 0)
		   {
			   set.setInUse(6, true);
			   set.setNumCharmSkill(1);
			   changeCharmSkill(1, rankInd, nSlot, true);
			   changeCharmPoint(1, rankInd, nSlot, -1, true);
		   }
		   else
		   {
			   if(nSlot <= 0)
				   set.setInUse(6, false);  //slot no use
			   set.setNumCharmSkill(0);
			   changeCharmSkill(1, rankInd, nSlot, false);
			   changeCharmPoint(1, rankInd, nSlot, -1, false);
		   }

	    }
	    else
	    {
		   //charm skill point 2
		   int ind = skillPoint2.getSelectedIndex();
		   int skillID = set.getCharmSkillID()[1];

		   if((ind < 0) || (skillID < 0))
		   {
			   set.setNumCharmSkill(0);
			   changeCharmPoint(1, rankInd, nSlot, -1, true);
			   return;
		   }

		   Skill skill = mhagData.getSkill(skillID);
		   int maxPoint = skill.getMaxSkillPoint(rankInd, nSlot);

		   set.setCharmSkillPoint(1,maxPoint - ind);
		   if(set.getCharmSkillPoint()[1] != 0)
		   {
			   set.setNumCharmSkill(2);
		   }
		   else
		   {
			   set.setNumCharmSkill(1);
		   }

	    }
	    calSetGUI();
    }

    private void jewelSlotAction(int bodyPart, int slotInd)
    {
	   if(adjust)return;  //don't perform action, when adjust combo box list;

	   JComboBox jewelSlot = getJewelSlotObj(bodyPart, slotInd);

	   int ind = jewelSlot.getSelectedIndex();
	   if(ind < 0) return; //initial menu

	   jewelInd[bodyPart][slotInd] = ind;

	   // change the other 2 comboBox

	   adjust = true;
	   int nSlot;
	   if(bodyPart < 5) // armor piece
	   {
		   Armor armor = mhagData.getArmor(bodyPart, set.getArmorID()[bodyPart]);
		   nSlot = armor.getNumSlot();  //armor slot
	   }
	   else if(bodyPart == 5) //weapon
	   {
		   nSlot = weaponMenu.getSelectedIndex();
	   }
	   else // charm
	   {
		   nSlot = set.getNumCharmSlot();
	   }

	   //special case [2/1/0]
  	   boolean match = check200(bodyPart, nSlot);

//	   boolean match = false;
	   if(!match)
	   {
		   for (int i = 0; i < nSlot; i++)
		   {
			   if(i == slotInd)continue;
			   int nRest = nSlot - restSlots(bodyPart, i);

			   if(nRest <= 0)
			   {
				   changeJewelSlot(bodyPart, i, set.getRank(), 0, false);
			   }
			   else
			   {
				   changeJewelSlot(bodyPart, i, set.getRank(), nRest, true);
			   }

		   }
	    }
//	   getJewel(bodyPart);

	   setJewelGUI(bodyPart);
	   calSetGUI();
//	   System.out.printf(">> %s %s %s\n",jewelMenuType[bodyPart][0],jewelMenuType[bodyPart][1],jewelMenuType[bodyPart][2]);
//	   System.out.printf("> %s %s %s\n",jewelInd[bodyPart][0],jewelInd[bodyPart][1],jewelInd[bodyPart][2]);

	   adjust = false;

    }

	// skill type combobox action
	private void skillTypeAction()
	{
	    int ind = skillType.getSelectedIndex();
	    if(ind < 0)return;
	    int[] idList = mhagData.getSkillList(ind);

	    skillTree.removeAllItems();
	    skillTree.addItem("");
	    for(int i = 0; i < idList.length; i++)
	    {
			Skill skill = mhagData.getSkill(idList[i]);
			if(language == 0)
				skillTree.addItem(skill.getSkillName());
			else
				skillTree.addItem(skill.getSkillNameJP());
	    }
		skillTree.setSelectedIndex(0);

	}

	// skill tree combobox action
	private void skillTreeAction()
	{
	    int ind = skillTree.getSelectedIndex();

		skillName.removeAllItems();
		skillName.addItem("");
	    if(ind > 0)
		{
			int indType = skillType.getSelectedIndex();
			int[] idList = mhagData.getSkillList(indType);
			int skillID = idList[ind -1];
			int[] effectList = mhagData.getEffectList(skillID);

			for(int i = 0; i < effectList.length; i++)
			{
				Effect effect = mhagData.getEffect(effectList[i]);
				if(language == 0)
					skillName.addItem(effect.getEffectName());
				else
					skillName.addItem(effect.getEffectNameJP());
			}
		}
		skillName.setSelectedIndex(0);

	}

	// skill add button action
	private void skillAddAction()
	{
		int indName = skillName.getSelectedIndex();
		if(indName <= 0)return;  // no effect selected
		//String name = skillName.getSelectedItem().toString();

		int num = gen.getNumEffectOpt();
		if(num >= 10)return;  // maximum 10 effects

		// calculate skillID and effectID
		int indType = skillType.getSelectedIndex();
		int indTree = skillTree.getSelectedIndex();
		int[] idList = mhagData.getSkillList(indType);
		int skillID = idList[indTree -1];
		int[] effectList = mhagData.getEffectList(skillID);
		int effectID = effectList[indName -1];

		// check if it overlaps with the previous skills
		for(int i = 0; i < num; i++)
		{
			if(skillID == gen.getSkills(i))
				return;
		}

		// add effect to the list
		//Skill skill = mhagData.getSkill(skillID);
		//String name = skill.getSkillName(); //always english
		Effect effect = mhagData.getEffect(effectID);
		String name = effect.getEffectName(); //always english
		listModelSkill.removeElementAt(num);
		listModelSkill.insertElementAt(name + ",", num);
		jListSkillList.setSelectedIndex(num);

		// update generator data
		gen.setNumEffectOpt(num + 1);
		gen.setSkills(num, skillID);
		gen.setEffects(num, effectID);
		//Effect effect = mhagData.getEffect(effectID);
		gen.setTriggers(num, effect.getEffectTrigger());

	}

	// skil list remove
	public void skillListRemoveAction()
	{
		int ind = jListSkillList.getSelectedIndex();
		if(ind < 0)return;  // no entry

		int num = gen.getNumEffectOpt();
		if(num <= 0)return; // no skill
		for(int i = ind; i < num - 1; i++)
		{
			listModelSkill.setElementAt(listModelSkill.getElementAt(i+1), i);
			gen.setSkills(i, gen.getSkills(i+1));
			gen.setEffects(i, gen.getEffects(i+1));
			gen.setTriggers(i, gen.getTriggers(i+1));
		}
		if(num > 0)
			listModelSkill.setElementAt("---", num - 1);


		gen.setSkills(num - 1, -1);
		gen.setEffects(num - 1, -1);
		gen.setTriggers(num - 1, 0);
		gen.setNumEffectOpt(num - 1);
		if(ind > 0 )
			jListSkillList.setSelectedIndex(ind - 1);
		else
			jListSkillList.setSelectedIndex(0);
	}

	// skill list move up
	public void skillListUpAction()
	{
		int ind = jListSkillList.getSelectedIndex();
		if(ind <= 0)return;   //first skill can't be moved up

		String name = listModelSkill.getElementAt(ind).toString();

		listModelSkill.setElementAt(listModelSkill.getElementAt(ind - 1), ind);
		listModelSkill.setElementAt(name, ind - 1);

		int temp = gen.getSkills(ind);
		gen.setSkills(ind, gen.getSkills(ind - 1));
		gen.setSkills(ind - 1, temp);

		temp = gen.getEffects(ind);
		gen.setEffects(ind, gen.getEffects(ind - 1));
		gen.setEffects(ind - 1, temp);

		temp = gen.getTriggers(ind);
		gen.setTriggers(ind, gen.getTriggers(ind - 1));
		gen.setTriggers(ind - 1, temp);

		jListSkillList.setSelectedIndex(ind - 1);
	}

	// skill list move down
	public void skillListDownAction()
	{
		int ind = jListSkillList.getSelectedIndex();
		if(ind >= gen.getNumEffectOpt() - 1)return;   //last skill can't be moved down

		String name = listModelSkill.getElementAt(ind).toString();

		listModelSkill.setElementAt(listModelSkill.getElementAt(ind + 1), ind);
		listModelSkill.setElementAt(name, ind + 1);

		int temp = gen.getSkills(ind);
		gen.setSkills(ind, gen.getSkills(ind + 1));
		gen.setSkills(ind + 1, temp);

		temp = gen.getEffects(ind);
		gen.setEffects(ind, gen.getEffects(ind + 1));
		gen.setEffects(ind + 1, temp);

		temp = gen.getTriggers(ind);
		gen.setTriggers(ind, gen.getTriggers(ind + 1));
		gen.setTriggers(ind + 1, temp);

		jListSkillList.setSelectedIndex(ind + 1);
	}

	/*
    // get Jewel ID according to jewel buttton position
    private void getJewelID(int bodyPart)
    {
	    int[] jewelID = new int[3];
	    Arrays.fill(jewelID,-1);
	    for (int i = 0; i < 3; i++)
	    {
		    int ind = jewelInd[bodyPart][i];
		    if(ind <= 0)continue;
		    int[] list = mhagData.getJewelList(set.getLowRank(), jewelMenuType[bodyPart][i]);
		    jewelID[i] = list[ind];
	    }
    }
	 */

    // [2/0/0] slot menu case, only show 2/1
    private boolean check200(int bodyPart, int Slot)
    {
	    if(Slot != 3) return false;

	    boolean if2Slot = false;
	    int[] indLeft = new int[3];
	    Arrays.fill(indLeft, -1);
	    int ind2nd = -1;

	    int j = 0;
	    for (int i = 0; i < 3; i++)
	    {
		    int[] list = mhagData.getJewelList(set.getRank(), jewelMenuType[bodyPart][i]);
		    int ind = jewelInd[bodyPart][i];
		    if(ind <= 0)
		    {
			    indLeft[j++] = i;
			    continue;
		    }
		    int nSlot = mhagData.getJewel(list[ind]).getNumSlot();
		    if(nSlot == 2)
		    {
			    if2Slot = true;
			    ind2nd = i;
		    }
		    else
			    return false;
	    }
	    if(if2Slot )  // 2 & 0 & (0)
	    {
		    changeJewelSlot(bodyPart, ind2nd, set.getRank(), 3, true);
		    changeJewelSlot(bodyPart, indLeft[0], set.getRank(), 1, true);
		    changeJewelSlot(bodyPart, indLeft[1], set.getRank(), 0, false);
		    return true;
	    }
	    else
		    return false;
    }

    private int restSlots(int bodyPart, int slotInd)
    {
	    int num = 0;
	    for(int i = 0; i < 3; i++)
	    {
		    if(slotInd == i)continue;
		    int ind = jewelInd[bodyPart][i];
		    if(ind <= 0)continue;
		    int[] list = mhagData.getJewelList(set.getRank(), jewelMenuType[bodyPart][i]);
		    int jewelID = list[ind];
		    num += mhagData.getJewel(jewelID).getNumSlot();
	    }
	    return num;
    }

    private void setJewelGUI(int bodyPart)
    {

	   int nJewel = 0;
	   for(int i = 0; i < 3; i++)
	   {
		   int ind = jewelInd[bodyPart][i];
		   if(ind <=0 ) continue;
		   int[] list = mhagData.getJewelList(set.getRank(), jewelMenuType[bodyPart][i]);
		   set.setJewelID(bodyPart, nJewel, list[ind]);
		   nJewel++;
	   }
	   set.setNumJewel(bodyPart, nJewel);
    }


    private void initMhag() throws FileNotFoundException
    {
	mhag.setMethod(0);  // default method: calculator
	//mhag.setLogOpt(0);  // log in console screen
	mhag.setLogOpt(2);  // turn off log
	mhag.prepareLogFile();

	mhag.showMhagInfo(); //display MHAG welcome info
	mhagData.readFile(mhag); //read file
	mhagData.dataPreProc();  //pre process

	Arrays.fill(deletedCodes, ""); //initiate deleted codes

	initGUISet();

    }

    private void initGUISet()
    {
	set.init();
	for (int i = 0; i < 7; i++)
	{
		Arrays.fill(jewelInd[i],0);   // init jewel IDs as null
		Arrays.fill(jewelMenuType[i],0);   // init jewel IDs as null
	}

	//initialize renderer
	for(int i = 0; i < 7; i++)
	{
		for(int j = 0; j < 3; j++)
		{
			renderer[i][j] = new ComboboxToolTipRenderer();
		        JComboBox jewelSlot = getJewelSlotObj(i, j);
			jewelSlot.setRenderer(renderer[i][j]);
		}
	}

	for(int i = 0; i < 5; i++)
	{
		rendererArmor[i] = new ComboboxToolTipRenderer();
		JComboBox bodyMenu = getArmorMenuObj(i);
		bodyMenu.setRenderer(rendererArmor[i]);
	}

    }

    /**
    * @param args the command line arguments
    */

    public JComboBox getArmorMenuObj(int bodyPart)
    {
	    JComboBox bodyMenu;
	    if(bodyPart == 0)
		    bodyMenu = headMenu;
	    else if(bodyPart == 1)
		    bodyMenu = chestMenu;
	    else if(bodyPart == 2)
		    bodyMenu = armsMenu;
	    else if(bodyPart == 3)
		    bodyMenu = waistMenu;
	    else
		    bodyMenu = legsMenu;

	    return bodyMenu;
    }

    public JComboBox getJewelSlotObj(int bodyPart, int slotInd)
    {
	    JComboBox jewelSlot;
	    if(bodyPart == 0)
	    {
		    if(slotInd == 0)
		    {
			    jewelSlot = headSlot1;
		    }
		    else if(slotInd == 1)
		    {
			    jewelSlot = headSlot2;
		    }
		    else
		    {
			    jewelSlot = headSlot3;
		    }
	    }
	    else if(bodyPart == 1)
	    {
		    if(slotInd == 0)
		    {
			    jewelSlot = chestSlot1;
		    }
		    else if(slotInd == 1)
		    {
			    jewelSlot = chestSlot2;
		    }
		    else
		    {
			    jewelSlot = chestSlot3;
		    }
	    }
	    else if(bodyPart == 2)
	    {
		    if(slotInd == 0)
		    {
			    jewelSlot = armSlot1;
		    }
		    else if(slotInd == 1)
		    {
			    jewelSlot = armSlot2;
		    }
		    else
		    {
			    jewelSlot = armSlot3;
		    }
	    }
	    else if(bodyPart == 3)
	    {
		    if(slotInd == 0)
		    {
			    jewelSlot = waistSlot1;
		    }
		    else if(slotInd == 1)
		    {
			    jewelSlot = waistSlot2;
		    }
		    else
		    {
			    jewelSlot = waistSlot3;
		    }
	    }
	    else if(bodyPart == 4)
	    {
		    if(slotInd == 0)
		    {
			    jewelSlot = legSlot1;
		    }
		    else if(slotInd == 1)
		    {
			    jewelSlot = legSlot2;
		    }
		    else
		    {
			    jewelSlot = legSlot3;
		    }
	    }
	    else if(bodyPart == 5)  //weapon
	    {
		    if(slotInd == 0)
		    {
			    jewelSlot = weaponSlot1;
		    }
		    else if(slotInd == 1)
		    {
			    jewelSlot = weaponSlot2;
		    }
		    else
		    {
			    jewelSlot = weaponSlot3;
		    }
	    }
	    else //charm slots
	    {
		    if(slotInd == 0)
		    {
			    jewelSlot = charmSlot1;
		    }
		    else if(slotInd == 1)
		    {
			    jewelSlot = charmSlot2;
		    }
		    else
		    {
			    jewelSlot = charmSlot3;
		    }
	    }
	    return jewelSlot;

    }

    public void changeArmorMenu(int bodyPart, int rankInd, boolean blade,
	    boolean female, boolean active)
    {
	    JComboBox bodyMenu = getArmorMenuObj(bodyPart);

	    if(!active)
	    {
		    bodyMenu.setVisible(false);
		    return;
	    }

	    int[] ind = mhagData.getArmorList(rankInd, blade, female, bodyPart);
	    int num = ind.length;
		//System.out.println(num);
	    String[] name = mhagData.getArmorListMenu(bodyPart, female, num, ind, language);

	    ArrayList<String> toolTips = new ArrayList<String>();

	    bodyMenu.removeAllItems();

	    //first null entry
	    bodyMenu.addItem(name[0]);
	    toolTips.add("");
	    for(int i = 1; i < num; i++)
	    {
		    bodyMenu.addItem(name[i]);
		    Armor armor = mhagData.getArmor(bodyPart, ind[i]);
		    toolTips.add(armor.getToolTips(mhagData, language));
	    }

	    rendererArmor[bodyPart].setTooltips(toolTips);
	    bodyMenu.setVisible(true);

    }

    public void changeJewelSlot(int bodyPart, int slotInd,
	    int rankInd, int nSlot, boolean active)
    {
	    int[] jewelIndOld = new int[3];
	    for (int i = 0; i < 3; i++)  //walkaround,,removeAllItems() kills some jewelInd data
		    jewelIndOld[i] = jewelInd[bodyPart][i];

	    JComboBox jewelSlot = getJewelSlotObj(bodyPart, slotInd);

	    if(!active)
	    {
		    jewelSlot.setVisible(false);
		    return;
	    }

	    int[] ind = mhagData.getJewelList(rankInd, nSlot);
	    int num = ind.length;

	    jewelSlot.removeAllItems();
	    ArrayList<String> toolTips = new ArrayList<String>();

	    jewelSlot.addItem(""); //1st null item
	    toolTips.add("");
	    for(int i = 1; i < num; i++)
	    {
 		    Jewel jewel = mhagData.getJewel(ind[i]);
		    jewelSlot.addItem(jewel.getJewelNameSkill(mhagData, language));
		    toolTips.add(jewel.getJewelToolTips(language));
	    }
	    renderer[bodyPart][slotInd].setTooltips(toolTips);
	    jewelSlot.setVisible(true);

	    // keep the jewel ID if previously active
	    for (int i = 0; i < 3; i++) //walkaround
		    jewelInd[bodyPart][i] = jewelIndOld[i];

	    int[] indOld = mhagData.getJewelList(rankInd, jewelMenuType[bodyPart][slotInd]);

	    int id = indOld[jewelInd[bodyPart][slotInd]];
	    if(id != -1 )
	    {
		    for (int i = 1; i < num; i++)
		    {
			    if(ind[i] == id)
			    {
				    jewelSlot.setSelectedIndex(i);
				    jewelInd[bodyPart][slotInd] = i;
				    break;
			    }
		    }
	    }

	    jewelMenuType[bodyPart][slotInd] = nSlot;
    }

	// adjust jewel slot menu items (selected index is not changed)
    public void AdjustJewelSlot(int bodyPart, int slotInd)
    {
    }

    public void changeCharmSkill(int skillNo, int rankInd, int nSlot, boolean active)
    {

	    JComboBox skillSlot;
	    int exception;
	    int[] ind;
	    if(skillNo == 0)
	    {
		    skillSlot = charmSkill1;
	   	    ind = mhagData.getSkillList(rankInd, nSlot);
	    }
	    else
	    {
		    skillSlot = charmSkill2;
		    exception = set.getCharmSkillID()[0];
	   	    ind = mhagData.getSkillList(rankInd, nSlot, exception, "Auto-Guard");
	    }

	    if(!active)
	    {
		    skillSlot.setVisible(false);
		    return;
	    }

		int num = ind.length;

		skillSlot.removeAllItems();
		skillSlot.addItem(""); 
		for(int i = 0; i < num; i++)
		{
			Skill skill = mhagData.getSkill(ind[i]);
			if(language == 0)
				skillSlot.addItem(skill.getSkillName());
			else
				skillSlot.addItem(skill.getSkillNameJP());
		}
		skillSlot.setSelectedIndex(0);

	    skillSlot.setVisible(true);
	    set.setCharmSkillID(skillNo,-1);

    }

    public void changeCharmPoint(int skillNo, int rankInd, int nSlot, int skillID, boolean active)
    {

	    JComboBox skillPoint;
	    if(skillNo == 0)
	    {
		    skillPoint = skillPoint1;
	    }
	    else
	    {
		    skillPoint = skillPoint2;
	    }

	    if(!active)
	    {
		    skillPoint.setVisible(false);
		    return;
	    }

	    if(skillID < 0)
	    {
			skillPoint.removeAllItems();
			set.setCharmSkillPoint(skillNo,0);
		    skillPoint.setVisible(false);
	    }
	    else
	    {
		    Skill skill = mhagData.getSkill(skillID);
		    int maxPoint = skill.getMaxSkillPoint(rankInd, nSlot);
		    int minPoint = 0;
		    if(skill.getSkillName().equals("Auto-Guard"))
			    minPoint = 10;   // fixed skill point for auto-guard
		    if(skillNo == 1)
			    minPoint = -10;

			skillPoint.removeAllItems();
			int j = 0;
			for(int i = maxPoint; i >= minPoint; i--)
			{
				skillPoint.addItem(i);
				if(i == 0)
					skillPoint.setSelectedIndex(j);
				j++;

			}
		    if(skill.getSkillName().equals("Auto-Guard"))
		    {
			    skillPoint.setSelectedIndex(0);
			    skillPoint.setVisible(true);
			    set.setCharmSkillPoint(skillNo,10);
			    set.setNumCharmSkill(1);
			    return;
		    }

		    skillPoint.setVisible(true);
		    set.setCharmSkillPoint(skillNo,0);
	    }
	    if(skillNo == 0)
		    set.setNumCharmSkill(0);
	    else
		    set.setNumCharmSkill(1);

    }
    
    public void changeCharmMenu(int rankInd)
    {

	charmMenu.removeAllItems();
	charmMenu.addItem("No Slot");
	charmMenu.addItem("1 Slot");
	charmMenu.addItem("2 Slots");
	if(rankInd != 0)  // high rank or G rank
		charmMenu.addItem("3 Slots");

	charmMenu.setSelectedIndex(0);
	charmMenu.setVisible(true);
    }

    public void initSetup(int rankInd, boolean blade, boolean female)
    {
		boolean showPreviewKeep = showPreview;
		showPreview = false;
	    for(int i = 0; i < 5; i++)
		    changeArmorMenu(i, rankInd, blade, female, true);

	    for(int i = 0; i < 7; i++)
	    {
		    for(int j = 0; j < 3; j++) // number 1-3
		    {
			changeJewelSlot(i, j, rankInd, 0, false);
		    }
	    }

	    weaponMenu.setSelectedIndex(0);  //reset Weapon menu

	    changeCharmMenu(rankInd);
	    changeCharmSkill(0, rankInd, 0 , true);
	    changeCharmSkill(1, rankInd, 0 , false);

		showPreview = true;
		calSetGUI();
		showPreview = showPreviewKeep;

    }

    public void changeGender(int rankInd, boolean blade, boolean female)
    {
	    adjust = true;
	    for(int i = 0; i < 5; i++)
	    {
		    JComboBox bodyMenu = getArmorMenuObj(i);

		    int entryOld = bodyMenu.getSelectedIndex();
		    int[] indOld = mhagData.getArmorList(rankInd, blade, !female, i);

		    int[] ind = mhagData.getArmorList(rankInd, blade, female, i);
		    int num = ind.length;
		    String[] name = mhagData.getArmorListMenu(i, female, num, ind, language);

		    ArrayList<String> toolTips = new ArrayList<String>();

		    bodyMenu.removeAllItems();
		    bodyMenu.addItem(name[0]);
		    toolTips.add("");
			boolean found = false;
		    for(int j = 1; j < num; j++)
		    {
			    bodyMenu.addItem(name[j]);
			    if(ind[j] == indOld[entryOld])
			    {
				    bodyMenu.setSelectedIndex(j);
					found = true;
			    }
			    Armor armor = mhagData.getArmor(i, ind[j]);
			    toolTips.add(armor.getToolTips(mhagData, language));
		    }
		    rendererArmor[i].setTooltips(toolTips);

			if(!found)  // reset armor menu
			{
				adjust = false;
				bodyMenu.setSelectedIndex(0);
				adjust = true; 
			}
	    }
	    adjust = false;

    }

    public void changeLanguage(boolean ifFemale)
    {
		String setCode = set.getSetCode();
	    loadSet2Calc(setCode);

		if(set.getSetGender(mhagData).equals("A"))
		{
			female.setSelected(false);
			set.setFemale(false);
			if(ifFemale)
			{
				female.setSelected(true);
				set.setFemale(true);
				changeGender(set.getRank(), set.getBlade(), set.getFemale());
			}
		}

		// generator panel
	    int skillTreeInd = skillTree.getSelectedIndex();
		int skillNameInd = skillName.getSelectedIndex();
		skillTypeAction();
		skillTree.setSelectedIndex(skillTreeInd);
		skillTreeAction();
		skillName.setSelectedIndex(skillNameInd);
    }

    public void calSetGUI()
    {
		if(!showPreview)return;
	   //boolean pass = set.checkSet(mhag, mhagData);  //check set
	   //if(!pass)
	   //{
	   //	   System.out.println("Error! Please Check!");
	   //      MhagUtil.logLine(mhag, "Error! Please Check!");
	   //}
	    String name = jTextSetName.getText();
	    set.setSetName(name);

	   set.calcSet(mhag, mhagData);   //calculate set

	   stream.reset();
  	   set.save(mhag, mhagData, stream);  // save results
	   if(showItem && mhagData.getIfItem())  // show materials
		   set.getItem(mhagData, stream);
	   stream.rewind();
    }

    //check preference file
    public void checkPref()
    {

	try {
		Scanner filein = new Scanner(new File(mhagData.getDirSave(game) + fileNamePref));

		int count = 0;
		while (filein.hasNext() && (count < 1))
		{
  			if(count == 0)
//			{
//				fileNameData = filein.nextLine();
//				jTextData.setText(fileNameData);
//			}
//			else
			{
				fileNameCodeBook = filein.nextLine();
				codeBookName.setText(fileNameCodeBook);
			}
			count++;
		}
		filein.close();


	} catch (FileNotFoundException ex) {
	}

    }

    // save preference file
    public void savePref() throws FileNotFoundException
    {
	    PrintStream fileout = new PrintStream(new File(mhagData.getDirSave(game) + fileNamePref));
//	    fileout.println(fileNameData);
	    fileout.println(fileNameCodeBook);
	    fileout.close();
    }

    // read help from USAGE.txt
	/*
    public void readHelp()
    {
	try {
		Scanner filein = new Scanner(new File("USAGE.txt"));

		Arrays.fill(helpData, "");
		int num = 0;

		    listModelHelp.clear();
		    while(filein.hasNext())
		    {
			    String line = filein.nextLine();
			    int pos = line.indexOf(":");
			    if(pos == -1)continue;

			    listModelHelp.addElement(line.substring(0, pos));
			    helpData[num] = line.substring(pos+1);
			    num++;
		    }

		    helpList.setModel(listModelHelp);


	} catch (FileNotFoundException ex) {
		return;
	}

    }
	 */

	public void setSkillTypeMenu()
	{
		skillType.addItem("Any");
	    for(int i = 1; i <= 7; i++)
	    {
			String name = Skill.getSkillTypeName(i);
		    skillType.addItem(name);
	    }
		skillType.setSelectedIndex(0);
	}

	// initialize Generator
	public void initGen()
	{
		gen.setMhag(mhag);
		gen.setMhagData(mhagData);

		setSkillTypeMenu();
		jComboBoxWeaponSlots.setSelectedIndex(0);
		jComboBoxOpt.setSelectedIndex(0);
		jComboBoxType.setSelectedIndex(0);
		jComboBoxRank.setSelectedIndex(0);
		jComboBoxHead.setSelectedIndex(0);
		jCheckBoxEarring.setSelected(true);
		jCheckBoxCharm.setSelected(false);
		jComboBoxGender.setSelectedIndex(0);

	    listModelSkill.clear();
	    jListSkillList.setModel(listModelSkill);
		for(int i = 0; i < 10; i++)
			listModelSkill.insertElementAt("---", i);
	    jListSkillList.clearSelection();

		jProgressOpt.setValue(0);
		jProgressOpt.setStringPainted(true);

	}

	public JProgressBar getProgressBar() {return jProgressOpt;}
	public MhagData getMhagData() {return mhagData;}

	// add auto-complete to all applicable jComboBox
	private void setupAutoCompleteAll()
	{
		LAFGUI.setupAutoComplete(skillTree);
		LAFGUI.setupAutoComplete(skillName);
		LAFGUI.setupAutoComplete(headMenu);
		LAFGUI.setupAutoComplete(chestMenu);
		LAFGUI.setupAutoComplete(armsMenu);
		LAFGUI.setupAutoComplete(waistMenu);
		LAFGUI.setupAutoComplete(legsMenu);
		LAFGUI.setupAutoComplete(weaponSlot1);
		LAFGUI.setupAutoComplete(weaponSlot2);
		LAFGUI.setupAutoComplete(weaponSlot3);
		LAFGUI.setupAutoComplete(headSlot1);
		LAFGUI.setupAutoComplete(headSlot2);
		LAFGUI.setupAutoComplete(headSlot3);
		LAFGUI.setupAutoComplete(chestSlot1);
		LAFGUI.setupAutoComplete(chestSlot2);
		LAFGUI.setupAutoComplete(chestSlot3);
		LAFGUI.setupAutoComplete(armSlot1);
		LAFGUI.setupAutoComplete(armSlot2);
		LAFGUI.setupAutoComplete(armSlot3);
		LAFGUI.setupAutoComplete(waistSlot1);
		LAFGUI.setupAutoComplete(waistSlot2);
		LAFGUI.setupAutoComplete(waistSlot3);
		LAFGUI.setupAutoComplete(legSlot1);
		LAFGUI.setupAutoComplete(legSlot2);
		LAFGUI.setupAutoComplete(legSlot3);
		LAFGUI.setupAutoComplete(charmSlot1);
		LAFGUI.setupAutoComplete(charmSlot2);
		LAFGUI.setupAutoComplete(charmSlot3);
		LAFGUI.setupAutoComplete(charmSlot3);
		LAFGUI.setupAutoComplete(charmSkill1);
		LAFGUI.setupAutoComplete(charmSkill2);
	}

	public void adjustRankMenu()
	{
		// update entries for mhtri and mhp3rd (no G rank)
		if((game == 0) || (game == 1))
		{
			rankMenu.removeItemAt(2);
			rankMenu.setSelectedIndex(1);
			jComboBoxRank.removeItemAt(5);
			jComboBoxRank.removeItemAt(4);
			jComboBoxRank.removeItemAt(3);
		}
		else
			rankMenu.setSelectedIndex(2);
	}

	// if material file does not exist,  disable materials check box
	public void adjustItemCheckBox()
	{
		if(!mhagData.getIfItem())
			materials.setEnabled(false);
	}

	// for specific game, create save dir if not exist
	public void createDefaultDir()
	{
		File theDir = new File(mhagData.getDirSave(game));
		if(!theDir.exists())
			theDir.mkdir();
	}

	// adjust GUI after data/info are read
	public void postProcess()
	{
		adjustRankMenu();
		adjustItemCheckBox();
		createDefaultDir();
	}

	/* backup
    private void highRankActionPerformed(java.awt.event.ActionEvent evt) {                                         
	    // set to high Rank
	    if(set.getLowRank() == false )return;

	    set.setLowRank(false);
	    initSetup(set.getLowRank(), set.getBlade(), set.getFemale());
    }                                        

    private void lowRankActionPerformed(java.awt.event.ActionEvent evt) {                                        
	    // set to Low Rank
	    if(set.getLowRank() == true )return;

	    set.setLowRank(true);
	    initSetup(set.getLowRank(), set.getBlade(), set.getFemale());
    }                                       
	 * 
	 */

    public static void main(String args[]) {

        java.awt.EventQueue.invokeLater(new Runnable() {

		@Override
		public void run() {

			try{
				UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
			  	LAFGUI.setupLAF(); //edit metal LAF
			} catch (Exception e) {System.out.println("error!");}

			ChooseGame chooseGame = new ChooseGame(new javax.swing.JFrame(), true);
			chooseGame.toFront();
			chooseGame.setVisible(true);   

			MhagGui mhagGui = new MhagGui(chooseGame.getGameOpt());
//			System.out.println("here");
			chooseGame.dispose();

			try {
				mhagGui.initMhag(); // initialize mhag
			} catch (FileNotFoundException ex) {
				Logger.getLogger(MhagGui.class.getName()).log(Level.SEVERE, null, ex);
			}

			mhagGui.checkPref();
			//mhagGui.readHelp();

			mhagGui.postProcess();
			mhagGui.setVisible(true);

			mhagGui.initSetup(mhagGui.mhagData.getMaxRank(mhagGui.game), true, false); // by default
			mhagGui.initGen();

			if((mhagGui.game == 0) || (mhagGui.game == 2))
				mhagGui.langMenu.setEnabled(false);

		//mhagGui.jTextUsage.setCaretPosition(0);
		//mhagGui.jTabbedPane.setEnabledAt(1, false); //diable generator panel


		}
        });
    }


	// GUI MHAG variables
	private int game; //game version: 0: tri; 1: p3rd; 2: mhfu; 3: mh3g
	private Mhag mhag;    // = new Mhag(0);  // 0: tri; 1: p3rd
	private Set set = new Set();
	private MhagData mhagData = new MhagData();
	private Generator gen = new Generator();
	private CharmDialog charmDialog;
	private GenAdvanced advDialog;
	private About aboutDialog;
	private int language = 0;   //0: english, 1: japanese

	//dialog setting
	private boolean ifCharm = false;
	private boolean ifAdvance = false;
	private boolean ifAbout = false;

	private TextAreaPrintStream stream, streamView, streamGen;
	private int[][] jewelInd = new int[7][3]; //jewel index in each jewel button list
	private int[][] jewelMenuType = new int[7][3]; //menu type in each jewel button position
	private boolean adjust = false; // adjust menu, don't perform calculation
	private boolean showPreview = true; // show preview
	private boolean showItem = false; // show materials
	int saveOpt =0;  //save option for GUI

	private ComboboxToolTipRenderer[][] renderer = new ComboboxToolTipRenderer[7][3];
	//renderer for slot menu tooltips
	private ComboboxToolTipRenderer[] rendererArmor = new ComboboxToolTipRenderer[5];

	private boolean codeBookInUse = false;
	private DefaultListModel listModel =  new DefaultListModel(); //viewer code list
	private DefaultListModel listModelSkill =  new DefaultListModel(); //generator skill list
	private DefaultListModel listModelOpt =  new DefaultListModel(); //generator search result list

	private String[] deletedCodes = new String[5]; //store deleted codes;

	// save code book
	private boolean codeBookChanged = false;   //save code book dialog
	//SaveAndExit dialogSave = new SaveAndExit(new javax.swing.JFrame(), true);

	// save code book/outputs data file names
	private final String fileNamePref = "pref";
//	private String fileNameData = "MyData";
	private String fileNameCodeBook = "MyData";

	//help list
	//private DefaultListModel listModelHelp =  new DefaultListModel(); //viewer help list
	//private String[] helpData = new String[100];  // help data, max 100 entries

	// generator thread
	private Task task;
	public class Task extends SwingWorker<Void, Void>
	{
		@Override
		public Void doInBackground()
		{
			mainTask(this);
			return null;
		}

		@Override
		public void done()
		{
			if(setCodeGUI != null)
				addOptList(setCodeGUI);

			long time2 = new Date().getTime() - cpuTime;
			disableGen(false);
			setCursor(null);
			//gen.initJewel(set.getLowRank());
			jProgressOpt.setValue(jProgressOpt.getMaximum());
			jProgressOpt.setString(String.format("%7.2fs   ",time2/1000.0));
		} 
	}

	private String[] setCodeGUI;
	private long cpuTime;

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton Output;
    private javax.swing.JButton aboutButton;
    private javax.swing.JComboBox armSlot1;
    private javax.swing.JComboBox armSlot2;
    private javax.swing.JComboBox armSlot3;
    private javax.swing.JLabel armsLabel;
    private javax.swing.JComboBox armsMenu;
    private javax.swing.JRadioButton blade;
    private javax.swing.JButton buttonGoto;
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.JButton buttonLink;
    private javax.swing.JPanel calculator;
    private javax.swing.JLabel charmLabel;
    private javax.swing.JComboBox charmMenu;
    private javax.swing.JComboBox charmSkill1;
    private javax.swing.JComboBox charmSkill2;
    private javax.swing.JLabel charmSkillLabel;
    private javax.swing.JComboBox charmSlot1;
    private javax.swing.JComboBox charmSlot2;
    private javax.swing.JComboBox charmSlot3;
    private javax.swing.JLabel chestLabel;
    private javax.swing.JComboBox chestMenu;
    private javax.swing.JComboBox chestSlot1;
    private javax.swing.JComboBox chestSlot2;
    private javax.swing.JComboBox chestSlot3;
    private javax.swing.JPanel codeBook;
    private javax.swing.JButton codeBookLoad;
    private javax.swing.JTextField codeBookName;
    private javax.swing.JButton codeBookSave;
    private javax.swing.JList codeList;
    private javax.swing.JPanel convert;
    private javax.swing.JRadioButton convertHTML;
    private javax.swing.JRadioButton convertTEXT;
    private javax.swing.JButton deleteInteract;
    private javax.swing.JRadioButton female;
    private javax.swing.JLabel genderLabel;
    private javax.swing.JPanel generator;
    private javax.swing.JButton getSetInteract;
    private javax.swing.JRadioButton gunner;
    private javax.swing.JLabel headLabel;
    private javax.swing.JLabel headLabel1;
    private javax.swing.JComboBox headMenu;
    private javax.swing.JComboBox headSlot1;
    private javax.swing.JComboBox headSlot2;
    private javax.swing.JComboBox headSlot3;
    private javax.swing.JPanel hunterType;
    private javax.swing.ButtonGroup hunterTypeGen;
    private javax.swing.ButtonGroup hunterTypeGroup;
    private javax.swing.JButton jButtonAbort;
    private javax.swing.JButton jButtonAdd;
    private javax.swing.JButton jButtonDown;
    private javax.swing.JButton jButtonMyCharms;
    private javax.swing.JButton jButtonRemove;
    private javax.swing.JButton jButtonSearch;
    private javax.swing.JButton jButtonSettings;
    private javax.swing.JButton jButtonShowPiece;
    private javax.swing.JButton jButtonUp;
    private javax.swing.JCheckBox jCheckBoxCharm;
    private javax.swing.JCheckBox jCheckBoxEarring;
    private javax.swing.JCheckBox jCheckBoxGun;
    private javax.swing.JComboBox jComboBoxGender;
    private javax.swing.JComboBox jComboBoxHead;
    private javax.swing.JComboBox jComboBoxOpt;
    private javax.swing.JComboBox jComboBoxRank;
    private javax.swing.JComboBox jComboBoxType;
    private javax.swing.JComboBox jComboBoxWeaponSlots;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabelArmorRank;
    private javax.swing.JLabel jLabelArmorType;
    private javax.swing.JLabel jLabelSkillName;
    private javax.swing.JLabel jLabelSkillTree;
    private javax.swing.JLabel jLabelSkillType;
    private javax.swing.JList jListOptSets;
    private javax.swing.JList jListSkillList;
    private javax.swing.JProgressBar jProgressOpt;
    private javax.swing.JScrollPane jScrollOptSets;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPreview;
    private javax.swing.JScrollPane jScrollPreview2;
    private javax.swing.JScrollPane jScrollPreview3;
    private javax.swing.JScrollPane jScrollSkillList;
    private javax.swing.JTabbedPane jTabbedPane;
    private javax.swing.JTextArea jTextPreview;
    private javax.swing.JTextArea jTextPreview2;
    private javax.swing.JTextArea jTextPreview3;
    private javax.swing.JTextField jTextSetName;
    private javax.swing.JLabel langLabel;
    private javax.swing.JComboBox langMenu;
    private javax.swing.JComboBox legSlot1;
    private javax.swing.JComboBox legSlot2;
    private javax.swing.JComboBox legSlot3;
    private javax.swing.JLabel legsLabel;
    private javax.swing.JComboBox legsMenu;
    private javax.swing.JButton loadSetInteract;
    private javax.swing.JButton loadToCalcGen;
    private javax.swing.JRadioButton male;
    private javax.swing.JCheckBox materials;
    private javax.swing.JLabel optLabel;
    private javax.swing.JPanel optionPanel;
    private javax.swing.JPanel output;
    private javax.swing.ButtonGroup outputGroup;
    private javax.swing.JPanel rank;
    private javax.swing.ButtonGroup rankGroup;
    private javax.swing.JComboBox rankMenu;
    private javax.swing.JButton reset;
    private javax.swing.JPanel setNamePanel;
    private javax.swing.JPanel setup;
    private javax.swing.JPanel sex;
    private javax.swing.ButtonGroup sexGroup;
    private javax.swing.JComboBox skillName;
    private javax.swing.JComboBox skillPoint1;
    private javax.swing.JComboBox skillPoint2;
    private javax.swing.JComboBox skillTree;
    private javax.swing.JComboBox skillType;
    private javax.swing.JPanel skillsPanel;
    private javax.swing.JButton undoInteract;
    private javax.swing.JPanel viewer;
    private javax.swing.JLabel waistLabel;
    private javax.swing.JComboBox waistMenu;
    private javax.swing.JComboBox waistSlot1;
    private javax.swing.JComboBox waistSlot2;
    private javax.swing.JComboBox waistSlot3;
    private javax.swing.JLabel weaponLabel;
    private javax.swing.JLabel weaponLabel1;
    private javax.swing.JComboBox weaponMenu;
    private javax.swing.JComboBox weaponSlot1;
    private javax.swing.JComboBox weaponSlot2;
    private javax.swing.JComboBox weaponSlot3;
    // End of variables declaration//GEN-END:variables

}
/*
 * 
 */
